From 272abe022b097be55b3542e97b7705ca0673c574 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 11 Jun 2018 23:49:40 +0000 Subject: [PATCH 1/3] Generated from bdcb59fb848aad33d655434511e28992a9186eec Added NodeJS + Java code gen config --- .../storagesyncManagement/LICENSE.txt | 21 + lib/services/storagesyncManagement/README.md | 40 + .../lib/microsoftStorageSync.d.ts | 81 + .../lib/microsoftStorageSync.js | 104 + .../lib/models/backupRequest.js | 52 + .../lib/models/cloudEndpoint.js | 128 + .../lib/models/cloudEndpointArray.js | 59 + .../lib/models/errorDetails.js | 68 + .../lib/models/errorModel.js | 74 + .../lib/models/index.d.ts | 520 +++ .../storagesyncManagement/lib/models/index.js | 47 + .../lib/models/operationDisplayInfo.js | 77 + .../lib/models/operationDisplayResource.js | 76 + .../lib/models/operationEntity.js | 78 + .../lib/models/operationEntityListResult.js | 68 + .../lib/models/postBackupResponse.js | 53 + .../lib/models/postRestoreRequest.js | 119 + .../lib/models/preRestoreRequest.js | 129 + .../lib/models/registeredServer.js | 173 + .../lib/models/registeredServerArray.js | 59 + .../lib/models/resource.js | 75 + .../lib/models/resourcesMoveInfo.js | 67 + .../lib/models/restoreFileSpec.js | 60 + .../lib/models/serverEndpoint.js | 216 + .../lib/models/serverEndpointArray.js | 59 + .../lib/models/storageSyncService.js | 66 + .../lib/models/storageSyncServiceArray.js | 59 + .../lib/models/subscriptionState.js | 69 + .../lib/models/syncGroup.js | 65 + .../lib/models/syncGroupArray.js | 59 + .../lib/models/trackedResource.js | 88 + .../lib/models/workflow.js | 90 + .../lib/models/workflowArray.js | 62 + .../lib/operations/abortWorkflows.js | 273 ++ .../lib/operations/cloudEndpointPostBackup.js | 526 +++ .../operations/cloudEndpointPostRestore.js | 581 +++ .../lib/operations/cloudEndpointPreBackup.js | 491 ++ .../lib/operations/cloudEndpointPreRestore.js | 605 +++ .../cloudEndpointRestoreHeatbeat.js | 283 ++ .../lib/operations/cloudEndpoints.js | 1328 ++++++ .../lib/operations/cloudEndpointsGet.js | 292 ++ .../lib/operations/getSyncGroups.js | 282 ++ .../lib/operations/index.d.ts | 4022 +++++++++++++++++ .../lib/operations/index.js | 36 + .../lib/operations/operationGet.js | 455 ++ .../lib/operations/registeredServers.js | 1328 ++++++ .../lib/operations/registeredServersGet.js | 282 ++ .../lib/operations/serverEndpointRecall.js | 450 ++ .../lib/operations/serverEndpoints.js | 2255 +++++++++ .../lib/operations/serverEndpointsGet.js | 292 ++ .../storageSyncServiceByResourceGroupGet.js | 271 ++ .../lib/operations/storageSyncServiceGet.js | 244 + .../lib/operations/storageSyncServices.js | 1066 +++++ .../lib/operations/syncGroups.js | 828 ++++ .../lib/operations/workflows.js | 292 ++ .../storagesyncManagement/package.json | 25 + 56 files changed, 19568 insertions(+) create mode 100644 lib/services/storagesyncManagement/LICENSE.txt create mode 100644 lib/services/storagesyncManagement/README.md create mode 100644 lib/services/storagesyncManagement/lib/microsoftStorageSync.d.ts create mode 100644 lib/services/storagesyncManagement/lib/microsoftStorageSync.js create mode 100644 lib/services/storagesyncManagement/lib/models/backupRequest.js create mode 100644 lib/services/storagesyncManagement/lib/models/cloudEndpoint.js create mode 100644 lib/services/storagesyncManagement/lib/models/cloudEndpointArray.js create mode 100644 lib/services/storagesyncManagement/lib/models/errorDetails.js create mode 100644 lib/services/storagesyncManagement/lib/models/errorModel.js create mode 100644 lib/services/storagesyncManagement/lib/models/index.d.ts create mode 100644 lib/services/storagesyncManagement/lib/models/index.js create mode 100644 lib/services/storagesyncManagement/lib/models/operationDisplayInfo.js create mode 100644 lib/services/storagesyncManagement/lib/models/operationDisplayResource.js create mode 100644 lib/services/storagesyncManagement/lib/models/operationEntity.js create mode 100644 lib/services/storagesyncManagement/lib/models/operationEntityListResult.js create mode 100644 lib/services/storagesyncManagement/lib/models/postBackupResponse.js create mode 100644 lib/services/storagesyncManagement/lib/models/postRestoreRequest.js create mode 100644 lib/services/storagesyncManagement/lib/models/preRestoreRequest.js create mode 100644 lib/services/storagesyncManagement/lib/models/registeredServer.js create mode 100644 lib/services/storagesyncManagement/lib/models/registeredServerArray.js create mode 100644 lib/services/storagesyncManagement/lib/models/resource.js create mode 100644 lib/services/storagesyncManagement/lib/models/resourcesMoveInfo.js create mode 100644 lib/services/storagesyncManagement/lib/models/restoreFileSpec.js create mode 100644 lib/services/storagesyncManagement/lib/models/serverEndpoint.js create mode 100644 lib/services/storagesyncManagement/lib/models/serverEndpointArray.js create mode 100644 lib/services/storagesyncManagement/lib/models/storageSyncService.js create mode 100644 lib/services/storagesyncManagement/lib/models/storageSyncServiceArray.js create mode 100644 lib/services/storagesyncManagement/lib/models/subscriptionState.js create mode 100644 lib/services/storagesyncManagement/lib/models/syncGroup.js create mode 100644 lib/services/storagesyncManagement/lib/models/syncGroupArray.js create mode 100644 lib/services/storagesyncManagement/lib/models/trackedResource.js create mode 100644 lib/services/storagesyncManagement/lib/models/workflow.js create mode 100644 lib/services/storagesyncManagement/lib/models/workflowArray.js create mode 100644 lib/services/storagesyncManagement/lib/operations/abortWorkflows.js create mode 100644 lib/services/storagesyncManagement/lib/operations/cloudEndpointPostBackup.js create mode 100644 lib/services/storagesyncManagement/lib/operations/cloudEndpointPostRestore.js create mode 100644 lib/services/storagesyncManagement/lib/operations/cloudEndpointPreBackup.js create mode 100644 lib/services/storagesyncManagement/lib/operations/cloudEndpointPreRestore.js create mode 100644 lib/services/storagesyncManagement/lib/operations/cloudEndpointRestoreHeatbeat.js create mode 100644 lib/services/storagesyncManagement/lib/operations/cloudEndpoints.js create mode 100644 lib/services/storagesyncManagement/lib/operations/cloudEndpointsGet.js create mode 100644 lib/services/storagesyncManagement/lib/operations/getSyncGroups.js create mode 100644 lib/services/storagesyncManagement/lib/operations/index.d.ts create mode 100644 lib/services/storagesyncManagement/lib/operations/index.js create mode 100644 lib/services/storagesyncManagement/lib/operations/operationGet.js create mode 100644 lib/services/storagesyncManagement/lib/operations/registeredServers.js create mode 100644 lib/services/storagesyncManagement/lib/operations/registeredServersGet.js create mode 100644 lib/services/storagesyncManagement/lib/operations/serverEndpointRecall.js create mode 100644 lib/services/storagesyncManagement/lib/operations/serverEndpoints.js create mode 100644 lib/services/storagesyncManagement/lib/operations/serverEndpointsGet.js create mode 100644 lib/services/storagesyncManagement/lib/operations/storageSyncServiceByResourceGroupGet.js create mode 100644 lib/services/storagesyncManagement/lib/operations/storageSyncServiceGet.js create mode 100644 lib/services/storagesyncManagement/lib/operations/storageSyncServices.js create mode 100644 lib/services/storagesyncManagement/lib/operations/syncGroups.js create mode 100644 lib/services/storagesyncManagement/lib/operations/workflows.js create mode 100644 lib/services/storagesyncManagement/package.json diff --git a/lib/services/storagesyncManagement/LICENSE.txt b/lib/services/storagesyncManagement/LICENSE.txt new file mode 100644 index 0000000000..5431ba98b9 --- /dev/null +++ b/lib/services/storagesyncManagement/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2018 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/lib/services/storagesyncManagement/README.md b/lib/services/storagesyncManagement/README.md new file mode 100644 index 0000000000..77b2ddfa0a --- /dev/null +++ b/lib/services/storagesyncManagement/README.md @@ -0,0 +1,40 @@ +--- +uid: azure-arm-storagesync +summary: *content + +--- +# Microsoft Azure SDK for Node.js - MicrosoftStorageSync +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-storagesync +``` + +## How to use + +### Authentication, client creation and list operationGet as an example. + +```javascript +const msRestAzure = require("ms-rest-azure"); +const MicrosoftStorageSync = require("azure-arm-storagesync"); +msRestAzure.interactiveLogin().then((creds) => { + const subscriptionId = ""; + const client = new MicrosoftStorageSync(creds, subscriptionId); + return client.operationGet.list().then((result) => { + console.log("The result is:"); + console.log(result); + }); +}).catch((err) => { + console.log('An error occurred:'); + console.dir(err, {depth: null, colors: true}); +}); + +## Related projects + +- [Microsoft Azure SDK for Node.js](https://github.com/Azure/azure-sdk-for-node) diff --git a/lib/services/storagesyncManagement/lib/microsoftStorageSync.d.ts b/lib/services/storagesyncManagement/lib/microsoftStorageSync.d.ts new file mode 100644 index 0000000000..94ee20f2c1 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/microsoftStorageSync.d.ts @@ -0,0 +1,81 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import { ServiceClientCredentials } from 'ms-rest'; +import { AzureServiceClient, AzureServiceClientOptions } from 'ms-rest-azure'; +import * as models from "./models"; +import * as operations from "./operations"; + +export default class MicrosoftStorageSync extends AzureServiceClient { + /** + * Initializes a new instance of the MicrosoftStorageSync class. + * @constructor + * + * @class + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * + * @param {string} subscriptionId - Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * + * @param {string} [baseUri] - The base URI of the service. + * + * @param {object} [options] - The parameter options + * + * @param {Array} [options.filters] - Filters to be added to the request pipeline + * + * @param {object} [options.requestOptions] - Options for the underlying request object + * {@link https://github.com/request/request#requestoptions-callback Options doc} + * + * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy + * + * @param {string} [options.acceptLanguage] - 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. + * + */ + constructor(credentials: ServiceClientCredentials, subscriptionId: string, baseUri?: string, options?: AzureServiceClientOptions); + + credentials: ServiceClientCredentials; + + subscriptionId: string; + + apiVersion: string; + + acceptLanguage: string; + + longRunningOperationRetryTimeout: number; + + generateClientRequestId: boolean; + + // Operation groups + operationGet: operations.OperationGet; + storageSyncServices: operations.StorageSyncServices; + storageSyncServiceByResourceGroupGet: operations.StorageSyncServiceByResourceGroupGet; + storageSyncServiceGet: operations.StorageSyncServiceGet; + getSyncGroups: operations.GetSyncGroups; + syncGroups: operations.SyncGroups; + cloudEndpoints: operations.CloudEndpoints; + cloudEndpointsGet: operations.CloudEndpointsGet; + cloudEndpointPreBackup: operations.CloudEndpointPreBackup; + cloudEndpointPostBackup: operations.CloudEndpointPostBackup; + cloudEndpointPreRestore: operations.CloudEndpointPreRestore; + cloudEndpointRestoreHeatbeat: operations.CloudEndpointRestoreHeatbeat; + cloudEndpointPostRestore: operations.CloudEndpointPostRestore; + serverEndpoints: operations.ServerEndpoints; + serverEndpointsGet: operations.ServerEndpointsGet; + serverEndpointRecall: operations.ServerEndpointRecall; + registeredServersGet: operations.RegisteredServersGet; + registeredServers: operations.RegisteredServers; + workflows: operations.Workflows; + abortWorkflows: operations.AbortWorkflows; +} + +export { MicrosoftStorageSync, models as MicrosoftStorageSyncModels }; diff --git a/lib/services/storagesyncManagement/lib/microsoftStorageSync.js b/lib/services/storagesyncManagement/lib/microsoftStorageSync.js new file mode 100644 index 0000000000..8428da46f1 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/microsoftStorageSync.js @@ -0,0 +1,104 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const ServiceClient = msRestAzure.AzureServiceClient; + +const models = require('./models'); +const operations = require('./operations'); + + +/** Class representing a MicrosoftStorageSync. */ +class MicrosoftStorageSync extends ServiceClient { + /** + * Create a MicrosoftStorageSync. + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * @param {string} subscriptionId - Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * @param {string} [baseUri] - The base URI of the service. + * @param {object} [options] - The parameter options + * @param {Array} [options.filters] - Filters to be added to the request pipeline + * @param {object} [options.requestOptions] - Options for the underlying request object + * {@link https://github.com/request/request#requestoptions-callback Options doc} + * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy + * @param {string} [options.acceptLanguage] - 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. + */ + constructor(credentials, subscriptionId, baseUri, options) { + if (credentials === null || credentials === undefined) { + throw new Error('\'credentials\' cannot be null.'); + } + if (subscriptionId === null || subscriptionId === undefined) { + throw new Error('\'subscriptionId\' cannot be null.'); + } + + if (!options) options = {}; + + super(credentials, options); + + this.apiVersion = '2017-06-05-preview'; + this.acceptLanguage = 'en-US'; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.baseUri = baseUri; + if (!this.baseUri) { + this.baseUri = 'https://azure.microsoft.com'; + } + this.credentials = credentials; + this.subscriptionId = subscriptionId; + + let packageInfo = this.getPackageJsonInfo(__dirname); + this.addUserAgentInfo(`${packageInfo.name}/${packageInfo.version}`); + if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { + this.acceptLanguage = options.acceptLanguage; + } + if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { + this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; + } + if(options.generateClientRequestId !== null && options.generateClientRequestId !== undefined) { + this.generateClientRequestId = options.generateClientRequestId; + } + this.operationGet = new operations.OperationGet(this); + this.storageSyncServices = new operations.StorageSyncServices(this); + this.storageSyncServiceByResourceGroupGet = new operations.StorageSyncServiceByResourceGroupGet(this); + this.storageSyncServiceGet = new operations.StorageSyncServiceGet(this); + this.getSyncGroups = new operations.GetSyncGroups(this); + this.syncGroups = new operations.SyncGroups(this); + this.cloudEndpoints = new operations.CloudEndpoints(this); + this.cloudEndpointsGet = new operations.CloudEndpointsGet(this); + this.cloudEndpointPreBackup = new operations.CloudEndpointPreBackup(this); + this.cloudEndpointPostBackup = new operations.CloudEndpointPostBackup(this); + this.cloudEndpointPreRestore = new operations.CloudEndpointPreRestore(this); + this.cloudEndpointRestoreHeatbeat = new operations.CloudEndpointRestoreHeatbeat(this); + this.cloudEndpointPostRestore = new operations.CloudEndpointPostRestore(this); + this.serverEndpoints = new operations.ServerEndpoints(this); + this.serverEndpointsGet = new operations.ServerEndpointsGet(this); + this.serverEndpointRecall = new operations.ServerEndpointRecall(this); + this.registeredServersGet = new operations.RegisteredServersGet(this); + this.registeredServers = new operations.RegisteredServers(this); + this.workflows = new operations.Workflows(this); + this.abortWorkflows = new operations.AbortWorkflows(this); + this.models = models; + msRest.addSerializationMixin(this); + } + +} + +module.exports = MicrosoftStorageSync; +module.exports['default'] = MicrosoftStorageSync; +module.exports.MicrosoftStorageSync = MicrosoftStorageSync; +module.exports.MicrosoftStorageSyncModels = models; diff --git a/lib/services/storagesyncManagement/lib/models/backupRequest.js b/lib/services/storagesyncManagement/lib/models/backupRequest.js new file mode 100644 index 0000000000..a87ef97efb --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/backupRequest.js @@ -0,0 +1,52 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Backup request + * + */ +class BackupRequest { + /** + * Create a BackupRequest. + * @member {string} [azureFileShare] Azure File Share. + */ + constructor() { + } + + /** + * Defines the metadata of BackupRequest + * + * @returns {object} metadata of BackupRequest + * + */ + mapper() { + return { + required: false, + serializedName: 'BackupRequest', + type: { + name: 'Composite', + className: 'BackupRequest', + modelProperties: { + azureFileShare: { + required: false, + serializedName: 'azureFileShare', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = BackupRequest; diff --git a/lib/services/storagesyncManagement/lib/models/cloudEndpoint.js b/lib/services/storagesyncManagement/lib/models/cloudEndpoint.js new file mode 100644 index 0000000000..771fbdfa32 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/cloudEndpoint.js @@ -0,0 +1,128 @@ +/* + * 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'); + +/** + * Cloud Endpoint object. + * + * @extends models['BaseResource'] + */ +class CloudEndpoint extends models['BaseResource'] { + /** + * Create a CloudEndpoint. + * @member {string} [storageAccountKey] Storage Account access key. + * @member {string} [storageAccount] Storage Account name. + * @member {string} [storageAccountResourceId] Storage Account Resource Id + * @member {string} [storageAccountShareName] Storage Account Share name + * @member {string} [storageAccountTenantId] Storage Account Tenant Id + * @member {string} [partnershipId] Partnership Id + * @member {string} [friendlyName] Friendly Name + * @member {boolean} [backupEnabled] Backup Enabled + * @member {string} [provisioningState] CloudEndpoint Provisioning State + * @member {string} [lastWorkflowId] CloudEndpoint lastWorkflowId + */ + constructor() { + super(); + } + + /** + * Defines the metadata of CloudEndpoint + * + * @returns {object} metadata of CloudEndpoint + * + */ + mapper() { + return { + required: false, + serializedName: 'CloudEndpoint', + type: { + name: 'Composite', + className: 'CloudEndpoint', + modelProperties: { + storageAccountKey: { + required: false, + serializedName: 'properties.storageAccountKey', + type: { + name: 'String' + } + }, + storageAccount: { + required: false, + serializedName: 'properties.storageAccount', + type: { + name: 'String' + } + }, + storageAccountResourceId: { + required: false, + serializedName: 'properties.storageAccountResourceId', + type: { + name: 'String' + } + }, + storageAccountShareName: { + required: false, + serializedName: 'properties.storageAccountShareName', + type: { + name: 'String' + } + }, + storageAccountTenantId: { + required: false, + serializedName: 'properties.storageAccountTenantId', + type: { + name: 'String' + } + }, + partnershipId: { + required: false, + serializedName: 'properties.partnershipId', + type: { + name: 'String' + } + }, + friendlyName: { + required: false, + serializedName: 'properties.friendlyName', + type: { + name: 'String' + } + }, + backupEnabled: { + required: false, + serializedName: 'properties.backupEnabled', + type: { + name: 'Boolean' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + lastWorkflowId: { + required: false, + serializedName: 'properties.lastWorkflowId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = CloudEndpoint; diff --git a/lib/services/storagesyncManagement/lib/models/cloudEndpointArray.js b/lib/services/storagesyncManagement/lib/models/cloudEndpointArray.js new file mode 100644 index 0000000000..9cbf3ca987 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/cloudEndpointArray.js @@ -0,0 +1,59 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Array of CloudEndpoint + */ +class CloudEndpointArray extends Array { + /** + * Create a CloudEndpointArray. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of CloudEndpointArray + * + * @returns {object} metadata of CloudEndpointArray + * + */ + mapper() { + return { + required: false, + serializedName: 'CloudEndpointArray', + type: { + name: 'Composite', + className: 'CloudEndpointArray', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'CloudEndpointElementType', + type: { + name: 'Composite', + className: 'CloudEndpoint' + } + } + } + } + } + } + }; + } +} + +module.exports = CloudEndpointArray; diff --git a/lib/services/storagesyncManagement/lib/models/errorDetails.js b/lib/services/storagesyncManagement/lib/models/errorDetails.js new file mode 100644 index 0000000000..0754c92926 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/errorDetails.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Error Details object. + * + */ +class ErrorDetails { + /** + * Create a ErrorDetails. + * @member {string} [code] Error code of the given entry. + * @member {string} [message] Error message of the given entry. + * @member {string} [target] Target of the given entry. + */ + constructor() { + } + + /** + * Defines the metadata of ErrorDetails + * + * @returns {object} metadata of ErrorDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'ErrorDetails', + type: { + name: 'Composite', + className: 'ErrorDetails', + modelProperties: { + code: { + required: false, + serializedName: 'code', + type: { + name: 'String' + } + }, + message: { + required: false, + serializedName: 'message', + type: { + name: 'String' + } + }, + target: { + required: false, + serializedName: 'target', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ErrorDetails; diff --git a/lib/services/storagesyncManagement/lib/models/errorModel.js b/lib/services/storagesyncManagement/lib/models/errorModel.js new file mode 100644 index 0000000000..bf9f0cf878 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/errorModel.js @@ -0,0 +1,74 @@ +/* + * 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'); + +/** + * Error type + * + */ +class ErrorModel { + /** + * Create a ErrorModel. + * @member {string} [code] Error code of the given entry. + * @member {string} [message] Error message of the given entry. + * @member {object} [details] Error details of the given entry. + * @member {string} [details.code] Error code of the given entry. + * @member {string} [details.message] Error message of the given entry. + * @member {string} [details.target] Target of the given entry. + */ + constructor() { + } + + /** + * Defines the metadata of ErrorModel + * + * @returns {object} metadata of ErrorModel + * + */ + mapper() { + return { + required: false, + serializedName: 'Error', + type: { + name: 'Composite', + className: 'ErrorModel', + modelProperties: { + code: { + required: false, + serializedName: 'code', + type: { + name: 'String' + } + }, + message: { + required: false, + serializedName: 'message', + type: { + name: 'String' + } + }, + details: { + required: false, + serializedName: 'details', + type: { + name: 'Composite', + className: 'ErrorDetails' + } + } + } + } + }; + } +} + +module.exports = ErrorModel; diff --git a/lib/services/storagesyncManagement/lib/models/index.d.ts b/lib/services/storagesyncManagement/lib/models/index.d.ts new file mode 100644 index 0000000000..3368f5159f --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/index.d.ts @@ -0,0 +1,520 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import { BaseResource } from 'ms-rest-azure'; +import { CloudError } from 'ms-rest-azure'; +import * as moment from 'moment'; + +export { BaseResource } from 'ms-rest-azure'; +export { CloudError } from 'ms-rest-azure'; + + +/** + * @class + * Initializes a new instance of the ErrorDetails class. + * @constructor + * Error Details object. + * + * @member {string} [code] Error code of the given entry. + * @member {string} [message] Error message of the given entry. + * @member {string} [target] Target of the given entry. + */ +export interface ErrorDetails { + code?: string; + message?: string; + target?: string; +} + +/** + * @class + * Initializes a new instance of the ErrorModel class. + * @constructor + * Error type + * + * @member {string} [code] Error code of the given entry. + * @member {string} [message] Error message of the given entry. + * @member {object} [details] Error details of the given entry. + * @member {string} [details.code] Error code of the given entry. + * @member {string} [details.message] Error message of the given entry. + * @member {string} [details.target] Target of the given entry. + */ +export interface ErrorModel { + code?: string; + message?: string; + details?: ErrorDetails; +} + +/** + * @class + * Initializes a new instance of the Resource class. + * @constructor + * The Azure Resource Manager resource. + * + * @member {string} [id] The id of the resource. + * @member {string} [name] The name of the resource. + * @member {string} [type] The type of the resource + */ +export interface Resource extends BaseResource { + readonly id?: string; + readonly name?: string; + readonly type?: string; +} + +/** + * @class + * Initializes a new instance of the TrackedResource class. + * @constructor + * ARM tracked resource + * + * @member {string} [location] The location of the resource. + * @member {object} [tags] The tags of the resource. + */ +export interface TrackedResource extends Resource { + location?: string; + tags?: any; +} + +/** + * @class + * Initializes a new instance of the SubscriptionState class. + * @constructor + * Subscription State object. + * + * @member {string} [state] State of Azure Subscription. Possible values + * include: 'Registered', 'Unregistered', 'Warned', 'Suspended', 'Deleted' + * @member {boolean} [istransitioning] Is Transitioning + * @member {object} [properties] Subscription state properties. + */ +export interface SubscriptionState { + state?: string; + istransitioning?: boolean; + properties?: any; +} + +/** + * @class + * Initializes a new instance of the StorageSyncService class. + * @constructor + * Storage Sync Service object. + * + * @member {number} [storageSyncServiceStatus] Storage Sync service status. + * @member {string} [storageSyncServiceUid] Storage Sync service Uid + */ +export interface StorageSyncService extends BaseResource { + readonly storageSyncServiceStatus?: number; + readonly storageSyncServiceUid?: string; +} + +/** + * @class + * Initializes a new instance of the SyncGroup class. + * @constructor + * Sync Group object. + * + * @member {string} [uniqueId] Unique Id + * @member {string} [syncGroupStatus] Sync group status + */ +export interface SyncGroup extends BaseResource { + uniqueId?: string; + readonly syncGroupStatus?: string; +} + +/** + * @class + * Initializes a new instance of the CloudEndpoint class. + * @constructor + * Cloud Endpoint object. + * + * @member {string} [storageAccountKey] Storage Account access key. + * @member {string} [storageAccount] Storage Account name. + * @member {string} [storageAccountResourceId] Storage Account Resource Id + * @member {string} [storageAccountShareName] Storage Account Share name + * @member {string} [storageAccountTenantId] Storage Account Tenant Id + * @member {string} [partnershipId] Partnership Id + * @member {string} [friendlyName] Friendly Name + * @member {boolean} [backupEnabled] Backup Enabled + * @member {string} [provisioningState] CloudEndpoint Provisioning State + * @member {string} [lastWorkflowId] CloudEndpoint lastWorkflowId + */ +export interface CloudEndpoint extends BaseResource { + storageAccountKey?: string; + storageAccount?: string; + storageAccountResourceId?: string; + storageAccountShareName?: string; + storageAccountTenantId?: string; + partnershipId?: string; + friendlyName?: string; + backupEnabled?: boolean; + provisioningState?: string; + lastWorkflowId?: string; +} + +/** + * @class + * Initializes a new instance of the ServerEndpoint class. + * @constructor + * Server Endpoint object. + * + * @member {string} [serverLocalPath] Server Local path. + * @member {string} [cloudTiering] Cloud Tiering. Possible values include: + * 'on', 'off' + * @member {number} [volumeFreeSpacePercent] Level of free space to be + * maintained by Cloud Tiering if it is enabled. + * @member {string} [friendlyName] Friendly Name + * @member {date} [lastSyncSuccess] Last Sync Success + * @member {string} [syncErrorState] Sync Error State + * @member {date} [syncErrorStateTimestamp] Sync Error State Timestamp + * @member {string} [syncErrorDirection] Sync Error Direction. Possible values + * include: 'none', 'initialize', 'download', 'upload', 'recall' + * @member {number} [itemUploadErrorCount] Item Upload Error Count. + * @member {number} [itemDownloadErrorCount] Item download error count. + * @member {string} [syncErrorContext] sync error context. + * @member {string} [currentProgressType] current progress type. Possible + * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * @member {number} [itemProgressCount] Item Progress Count + * @member {number} [itemTotalCount] Item Total Count + * @member {number} [byteProgress] Bytes in progress + * @member {number} [totalProgress] Total progress + * @member {number} [byteTotal] Bytes total + * @member {string} [serverResourceId] Server Resource Id. + * @member {string} [provisioningState] ServerEndpoint Provisioning State + * @member {string} [lastWorkflowId] ServerEndpoint lastWorkflowId + */ +export interface ServerEndpoint extends BaseResource { + serverLocalPath?: string; + cloudTiering?: string; + volumeFreeSpacePercent?: number; + friendlyName?: string; + lastSyncSuccess?: Date; + syncErrorState?: string; + syncErrorStateTimestamp?: Date; + syncErrorDirection?: string; + itemUploadErrorCount?: number; + itemDownloadErrorCount?: number; + syncErrorContext?: string; + currentProgressType?: string; + itemProgressCount?: number; + itemTotalCount?: number; + byteProgress?: number; + totalProgress?: number; + byteTotal?: number; + serverResourceId?: string; + provisioningState?: string; + lastWorkflowId?: string; +} + +/** + * @class + * Initializes a new instance of the RegisteredServer class. + * @constructor + * Registered Server resource. + * + * @member {string} [id] Resource Id + * @member {string} [name] Resource name + * @member {string} [type] Resource type + * @member {string} [serverCertificate] Registered Server Certificate + * @member {string} [agentVersion] Registered Server Agent Version + * @member {string} [serverOSVersion] Registered Server OS Version + * @member {number} [serverManagementtErrorCode] Registered Server Management + * Error Code + * @member {string} [lastHeartBeat] Registered Server last heart beat + * @member {string} [provisioningState] Registered Server Provisioning State + * @member {string} [serverRole] Registered Server serverRole + * @member {string} [clusterId] Registered Server clusterId + * @member {string} [clusterName] Registered Server clusterName + * @member {string} [serverId] Registered Server serverId + * @member {string} [storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * @member {string} [lastWorkflowId] Registered Server lastWorkflowId + */ +export interface RegisteredServer extends BaseResource { + readonly id?: string; + readonly name?: string; + readonly type?: string; + serverCertificate?: string; + agentVersion?: string; + serverOSVersion?: string; + serverManagementtErrorCode?: number; + lastHeartBeat?: string; + provisioningState?: string; + serverRole?: string; + clusterId?: string; + clusterName?: string; + serverId?: string; + storageSyncServiceUid?: string; + lastWorkflowId?: string; +} + +/** + * @class + * Initializes a new instance of the ResourcesMoveInfo class. + * @constructor + * Resource Move Info. + * + * @member {string} [targetResourceGroup] Target resource group. + * @member {array} [resources] Collection of Resources. + */ +export interface ResourcesMoveInfo { + targetResourceGroup?: string; + resources?: string[]; +} + +/** + * @class + * Initializes a new instance of the Workflow class. + * @constructor + * Workflow resource. + * + * @member {string} [lastStepName] last step name + * @member {string} [status] workflow status. Possible values include: + * 'active', 'expired', 'succeeded', 'aborted', 'failed' + * @member {string} [operation] operation direction. Possible values include: + * 'do', 'undo', 'cancel' + * @member {string} [steps] workflow steps + * @member {string} [lastOperationId] workflow last operation identifier. + */ +export interface Workflow extends BaseResource { + lastStepName?: string; + status?: string; + operation?: string; + steps?: string; + lastOperationId?: string; +} + +/** + * @class + * Initializes a new instance of the OperationDisplayInfo class. + * @constructor + * The operation supported by storage sync. + * + * @member {string} [description] The description of the operation. + * @member {string} [operation] The action that users can perform, based on + * their permission level. + * @member {string} [provider] Service provider: Microsoft StorageSync. + * @member {string} [resource] Resource on which the operation is performed. + */ +export interface OperationDisplayInfo { + description?: string; + operation?: string; + provider?: string; + resource?: string; +} + +/** + * @class + * Initializes a new instance of the OperationEntity class. + * @constructor + * The operation supported by storage sync. + * + * @member {string} [name] Operation name: {provider}/{resource}/{operation}. + * @member {object} [display] The operation supported by storage sync. + * @member {string} [display.description] The description of the operation. + * @member {string} [display.operation] The action that users can perform, + * based on their permission level. + * @member {string} [display.provider] Service provider: Microsoft StorageSync. + * @member {string} [display.resource] Resource on which the operation is + * performed. + * @member {string} [origin] The origin. + */ +export interface OperationEntity { + name?: string; + display?: OperationDisplayInfo; + origin?: string; +} + +/** + * @class + * Initializes a new instance of the OperationDisplayResource class. + * @constructor + * Operation Display Resource object. + * + * @member {string} [provider] Operation Display Resource Provider. + * @member {string} [resource] Operation Display Resource. + * @member {string} [operation] Operation Display Resource Operation. + * @member {string} [description] Operation Display Resource Description. + */ +export interface OperationDisplayResource { + provider?: string; + resource?: string; + operation?: string; + description?: string; +} + +/** + * @class + * Initializes a new instance of the RestoreFileSpec class. + * @constructor + * Restore file spec. + * + * @member {string} [path] Restore file spec path + * @member {boolean} [isdir] Restore file spec isdir + */ +export interface RestoreFileSpec { + path?: string; + isdir?: boolean; +} + +/** + * @class + * Initializes a new instance of the PostRestoreRequest class. + * @constructor + * Post Restore Request + * + * @member {string} [partition] Post Restore partition. + * @member {string} [replicaGroup] Post Restore replica group. + * @member {string} [requestId] Post Restore request id. + * @member {string} [azureFileShareUri] Post Restore Azure file share uri. + * @member {string} [status] Post Restore Azure status. + * @member {string} [sourceAzureFileShareUri] Post Restore Azure source azure + * file share uri. + * @member {string} [failedFileList] Post Restore Azure failed file list. + * @member {array} [restoreFileSpec] Post Restore restore file spec array. + */ +export interface PostRestoreRequest { + partition?: string; + replicaGroup?: string; + requestId?: string; + azureFileShareUri?: string; + status?: string; + sourceAzureFileShareUri?: string; + failedFileList?: string; + restoreFileSpec?: RestoreFileSpec[]; +} + +/** + * @class + * Initializes a new instance of the PreRestoreRequest class. + * @constructor + * Pre Restore request object. + * + * @member {string} [partition] Pre Restore partition. + * @member {string} [replicaGroup] Pre Restore replica group. + * @member {string} [requestId] Pre Restore request id. + * @member {string} [azureFileShareUri] Pre Restore Azure file share uri. + * @member {string} [status] Pre Restore Azure status. + * @member {string} [sourceAzureFileShareUri] Pre Restore Azure source azure + * file share uri. + * @member {string} [backupMetadataPropertyBag] Pre Restore backup metadata + * property bag. + * @member {array} [restoreFileSpec] Pre Restore restore file spec array. + * @member {number} [pausewaitforsyncdraintimeperiodinseconds] Pre Restore + * pause wait for sync drain time period in seconds. + */ +export interface PreRestoreRequest { + partition?: string; + replicaGroup?: string; + requestId?: string; + azureFileShareUri?: string; + status?: string; + sourceAzureFileShareUri?: string; + backupMetadataPropertyBag?: string; + restoreFileSpec?: RestoreFileSpec[]; + pausewaitforsyncdraintimeperiodinseconds?: number; +} + +/** + * @class + * Initializes a new instance of the BackupRequest class. + * @constructor + * Backup request + * + * @member {string} [azureFileShare] Azure File Share. + */ +export interface BackupRequest { + azureFileShare?: string; +} + +/** + * @class + * Initializes a new instance of the PostBackupResponse class. + * @constructor + * Post Backup Response + * + * @member {string} [cloudEndpointName] cloud endpoint Name. + */ +export interface PostBackupResponse { + readonly cloudEndpointName?: string; +} + +/** + * @class + * Initializes a new instance of the WorkflowArray class. + * @constructor + * Array of Workflow + * + * @member {array} [value] Collection of workflow items. + */ +export interface WorkflowArray { + value?: Workflow[]; +} + + +/** + * @class + * Initializes a new instance of the OperationEntityListResult class. + * @constructor + * The list of storage sync operations. + * + * @member {string} [nextLink] The link used to get the next page of + * operations. + */ +export interface OperationEntityListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the StorageSyncServiceArray class. + * @constructor + * Array of StorageSyncServices + * + */ +export interface StorageSyncServiceArray extends Array { +} + +/** + * @class + * Initializes a new instance of the SyncGroupArray class. + * @constructor + * Array of SyncGroup + * + */ +export interface SyncGroupArray extends Array { +} + +/** + * @class + * Initializes a new instance of the CloudEndpointArray class. + * @constructor + * Array of CloudEndpoint + * + */ +export interface CloudEndpointArray extends Array { +} + +/** + * @class + * Initializes a new instance of the ServerEndpointArray class. + * @constructor + * Array of ServerEndpoint + * + */ +export interface ServerEndpointArray extends Array { +} + +/** + * @class + * Initializes a new instance of the RegisteredServerArray class. + * @constructor + * Array of RegisteredServer + * + */ +export interface RegisteredServerArray extends Array { +} diff --git a/lib/services/storagesyncManagement/lib/models/index.js b/lib/services/storagesyncManagement/lib/models/index.js new file mode 100644 index 0000000000..aabbb684aa --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/index.js @@ -0,0 +1,47 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +var msRestAzure = require('ms-rest-azure'); + +exports.BaseResource = msRestAzure.BaseResource; +exports.CloudError = msRestAzure.CloudError; +exports.ErrorDetails = require('./errorDetails'); +exports.ErrorModel = require('./errorModel'); +exports.Resource = require('./resource'); +exports.TrackedResource = require('./trackedResource'); +exports.SubscriptionState = require('./subscriptionState'); +exports.StorageSyncService = require('./storageSyncService'); +exports.SyncGroup = require('./syncGroup'); +exports.CloudEndpoint = require('./cloudEndpoint'); +exports.ServerEndpoint = require('./serverEndpoint'); +exports.RegisteredServer = require('./registeredServer'); +exports.ResourcesMoveInfo = require('./resourcesMoveInfo'); +exports.Workflow = require('./workflow'); +exports.OperationDisplayInfo = require('./operationDisplayInfo'); +exports.OperationEntity = require('./operationEntity'); +exports.OperationDisplayResource = require('./operationDisplayResource'); +exports.RestoreFileSpec = require('./restoreFileSpec'); +exports.PostRestoreRequest = require('./postRestoreRequest'); +exports.PreRestoreRequest = require('./preRestoreRequest'); +exports.BackupRequest = require('./backupRequest'); +exports.PostBackupResponse = require('./postBackupResponse'); +exports.WorkflowArray = require('./workflowArray'); +exports.OperationEntityListResult = require('./operationEntityListResult'); +exports.StorageSyncServiceArray = require('./storageSyncServiceArray'); +exports.SyncGroupArray = require('./syncGroupArray'); +exports.CloudEndpointArray = require('./cloudEndpointArray'); +exports.ServerEndpointArray = require('./serverEndpointArray'); +exports.RegisteredServerArray = require('./registeredServerArray'); diff --git a/lib/services/storagesyncManagement/lib/models/operationDisplayInfo.js b/lib/services/storagesyncManagement/lib/models/operationDisplayInfo.js new file mode 100644 index 0000000000..cf5183c004 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/operationDisplayInfo.js @@ -0,0 +1,77 @@ +/* + * 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 operation supported by storage sync. + * + */ +class OperationDisplayInfo { + /** + * Create a OperationDisplayInfo. + * @member {string} [description] The description of the operation. + * @member {string} [operation] The action that users can perform, based on + * their permission level. + * @member {string} [provider] Service provider: Microsoft StorageSync. + * @member {string} [resource] Resource on which the operation is performed. + */ + constructor() { + } + + /** + * Defines the metadata of OperationDisplayInfo + * + * @returns {object} metadata of OperationDisplayInfo + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationDisplayInfo', + type: { + name: 'Composite', + className: 'OperationDisplayInfo', + modelProperties: { + description: { + required: false, + serializedName: 'description', + type: { + name: 'String' + } + }, + operation: { + required: false, + serializedName: 'operation', + type: { + name: 'String' + } + }, + provider: { + required: false, + serializedName: 'provider', + type: { + name: 'String' + } + }, + resource: { + required: false, + serializedName: 'resource', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationDisplayInfo; diff --git a/lib/services/storagesyncManagement/lib/models/operationDisplayResource.js b/lib/services/storagesyncManagement/lib/models/operationDisplayResource.js new file mode 100644 index 0000000000..5e67311540 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/operationDisplayResource.js @@ -0,0 +1,76 @@ +/* + * 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'; + +/** + * Operation Display Resource object. + * + */ +class OperationDisplayResource { + /** + * Create a OperationDisplayResource. + * @member {string} [provider] Operation Display Resource Provider. + * @member {string} [resource] Operation Display Resource. + * @member {string} [operation] Operation Display Resource Operation. + * @member {string} [description] Operation Display Resource Description. + */ + constructor() { + } + + /** + * Defines the metadata of OperationDisplayResource + * + * @returns {object} metadata of OperationDisplayResource + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationDisplayResource', + type: { + name: 'Composite', + className: 'OperationDisplayResource', + modelProperties: { + provider: { + required: false, + serializedName: 'provider', + type: { + name: 'String' + } + }, + resource: { + required: false, + serializedName: 'resource', + type: { + name: 'String' + } + }, + operation: { + required: false, + serializedName: 'operation', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'description', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationDisplayResource; diff --git a/lib/services/storagesyncManagement/lib/models/operationEntity.js b/lib/services/storagesyncManagement/lib/models/operationEntity.js new file mode 100644 index 0000000000..8d29602603 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/operationEntity.js @@ -0,0 +1,78 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The operation supported by storage sync. + * + */ +class OperationEntity { + /** + * Create a OperationEntity. + * @member {string} [name] Operation name: {provider}/{resource}/{operation}. + * @member {object} [display] The operation supported by storage sync. + * @member {string} [display.description] The description of the operation. + * @member {string} [display.operation] The action that users can perform, + * based on their permission level. + * @member {string} [display.provider] Service provider: Microsoft + * StorageSync. + * @member {string} [display.resource] Resource on which the operation is + * performed. + * @member {string} [origin] The origin. + */ + constructor() { + } + + /** + * Defines the metadata of OperationEntity + * + * @returns {object} metadata of OperationEntity + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationEntity', + type: { + name: 'Composite', + className: 'OperationEntity', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + display: { + required: false, + serializedName: 'display', + type: { + name: 'Composite', + className: 'OperationDisplayInfo' + } + }, + origin: { + required: false, + serializedName: 'origin', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationEntity; diff --git a/lib/services/storagesyncManagement/lib/models/operationEntityListResult.js b/lib/services/storagesyncManagement/lib/models/operationEntityListResult.js new file mode 100644 index 0000000000..f2fd520020 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/operationEntityListResult.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The list of storage sync operations. + */ +class OperationEntityListResult extends Array { + /** + * Create a OperationEntityListResult. + * @member {string} [nextLink] The link used to get the next page of + * operations. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of OperationEntityListResult + * + * @returns {object} metadata of OperationEntityListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationEntityListResult', + type: { + name: 'Composite', + className: 'OperationEntityListResult', + modelProperties: { + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + }, + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'OperationEntityElementType', + type: { + name: 'Composite', + className: 'OperationEntity' + } + } + } + } + } + } + }; + } +} + +module.exports = OperationEntityListResult; diff --git a/lib/services/storagesyncManagement/lib/models/postBackupResponse.js b/lib/services/storagesyncManagement/lib/models/postBackupResponse.js new file mode 100644 index 0000000000..dfb4c14bf1 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/postBackupResponse.js @@ -0,0 +1,53 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Post Backup Response + * + */ +class PostBackupResponse { + /** + * Create a PostBackupResponse. + * @member {string} [cloudEndpointName] cloud endpoint Name. + */ + constructor() { + } + + /** + * Defines the metadata of PostBackupResponse + * + * @returns {object} metadata of PostBackupResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'PostBackupResponse', + type: { + name: 'Composite', + className: 'PostBackupResponse', + modelProperties: { + cloudEndpointName: { + required: false, + readOnly: true, + serializedName: 'backupMetadata.cloudEndpointName', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = PostBackupResponse; diff --git a/lib/services/storagesyncManagement/lib/models/postRestoreRequest.js b/lib/services/storagesyncManagement/lib/models/postRestoreRequest.js new file mode 100644 index 0000000000..82450187a5 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/postRestoreRequest.js @@ -0,0 +1,119 @@ +/* + * 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'); + +/** + * Post Restore Request + * + */ +class PostRestoreRequest { + /** + * Create a PostRestoreRequest. + * @member {string} [partition] Post Restore partition. + * @member {string} [replicaGroup] Post Restore replica group. + * @member {string} [requestId] Post Restore request id. + * @member {string} [azureFileShareUri] Post Restore Azure file share uri. + * @member {string} [status] Post Restore Azure status. + * @member {string} [sourceAzureFileShareUri] Post Restore Azure source azure + * file share uri. + * @member {string} [failedFileList] Post Restore Azure failed file list. + * @member {array} [restoreFileSpec] Post Restore restore file spec array. + */ + constructor() { + } + + /** + * Defines the metadata of PostRestoreRequest + * + * @returns {object} metadata of PostRestoreRequest + * + */ + mapper() { + return { + required: false, + serializedName: 'PostRestoreRequest', + type: { + name: 'Composite', + className: 'PostRestoreRequest', + modelProperties: { + partition: { + required: false, + serializedName: 'partition', + type: { + name: 'String' + } + }, + replicaGroup: { + required: false, + serializedName: 'replicaGroup', + type: { + name: 'String' + } + }, + requestId: { + required: false, + serializedName: 'requestId', + type: { + name: 'String' + } + }, + azureFileShareUri: { + required: false, + serializedName: 'azureFileShareUri', + type: { + name: 'String' + } + }, + status: { + required: false, + serializedName: 'status', + type: { + name: 'String' + } + }, + sourceAzureFileShareUri: { + required: false, + serializedName: 'sourceAzureFileShareUri', + type: { + name: 'String' + } + }, + failedFileList: { + required: false, + serializedName: 'failedFileList', + type: { + name: 'String' + } + }, + restoreFileSpec: { + required: false, + serializedName: 'restoreFileSpec', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'RestoreFileSpecElementType', + type: { + name: 'Composite', + className: 'RestoreFileSpec' + } + } + } + } + } + } + }; + } +} + +module.exports = PostRestoreRequest; diff --git a/lib/services/storagesyncManagement/lib/models/preRestoreRequest.js b/lib/services/storagesyncManagement/lib/models/preRestoreRequest.js new file mode 100644 index 0000000000..6578ef5480 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/preRestoreRequest.js @@ -0,0 +1,129 @@ +/* + * 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'); + +/** + * Pre Restore request object. + * + */ +class PreRestoreRequest { + /** + * Create a PreRestoreRequest. + * @member {string} [partition] Pre Restore partition. + * @member {string} [replicaGroup] Pre Restore replica group. + * @member {string} [requestId] Pre Restore request id. + * @member {string} [azureFileShareUri] Pre Restore Azure file share uri. + * @member {string} [status] Pre Restore Azure status. + * @member {string} [sourceAzureFileShareUri] Pre Restore Azure source azure + * file share uri. + * @member {string} [backupMetadataPropertyBag] Pre Restore backup metadata + * property bag. + * @member {array} [restoreFileSpec] Pre Restore restore file spec array. + * @member {number} [pausewaitforsyncdraintimeperiodinseconds] Pre Restore + * pause wait for sync drain time period in seconds. + */ + constructor() { + } + + /** + * Defines the metadata of PreRestoreRequest + * + * @returns {object} metadata of PreRestoreRequest + * + */ + mapper() { + return { + required: false, + serializedName: 'PreRestoreRequest', + type: { + name: 'Composite', + className: 'PreRestoreRequest', + modelProperties: { + partition: { + required: false, + serializedName: 'partition', + type: { + name: 'String' + } + }, + replicaGroup: { + required: false, + serializedName: 'replicaGroup', + type: { + name: 'String' + } + }, + requestId: { + required: false, + serializedName: 'requestId', + type: { + name: 'String' + } + }, + azureFileShareUri: { + required: false, + serializedName: 'azureFileShareUri', + type: { + name: 'String' + } + }, + status: { + required: false, + serializedName: 'status', + type: { + name: 'String' + } + }, + sourceAzureFileShareUri: { + required: false, + serializedName: 'sourceAzureFileShareUri', + type: { + name: 'String' + } + }, + backupMetadataPropertyBag: { + required: false, + serializedName: 'backupMetadataPropertyBag', + type: { + name: 'String' + } + }, + restoreFileSpec: { + required: false, + serializedName: 'restoreFileSpec', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'RestoreFileSpecElementType', + type: { + name: 'Composite', + className: 'RestoreFileSpec' + } + } + } + }, + pausewaitforsyncdraintimeperiodinseconds: { + required: false, + serializedName: 'pausewaitforsyncdraintimeperiodinseconds', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = PreRestoreRequest; diff --git a/lib/services/storagesyncManagement/lib/models/registeredServer.js b/lib/services/storagesyncManagement/lib/models/registeredServer.js new file mode 100644 index 0000000000..6edbd83efb --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/registeredServer.js @@ -0,0 +1,173 @@ +/* + * 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'); + +/** + * Registered Server resource. + * + * @extends models['BaseResource'] + */ +class RegisteredServer extends models['BaseResource'] { + /** + * Create a RegisteredServer. + * @member {string} [id] Resource Id + * @member {string} [name] Resource name + * @member {string} [type] Resource type + * @member {string} [serverCertificate] Registered Server Certificate + * @member {string} [agentVersion] Registered Server Agent Version + * @member {string} [serverOSVersion] Registered Server OS Version + * @member {number} [serverManagementtErrorCode] Registered Server Management + * Error Code + * @member {string} [lastHeartBeat] Registered Server last heart beat + * @member {string} [provisioningState] Registered Server Provisioning State + * @member {string} [serverRole] Registered Server serverRole + * @member {string} [clusterId] Registered Server clusterId + * @member {string} [clusterName] Registered Server clusterName + * @member {string} [serverId] Registered Server serverId + * @member {string} [storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * @member {string} [lastWorkflowId] Registered Server lastWorkflowId + */ + constructor() { + super(); + } + + /** + * Defines the metadata of RegisteredServer + * + * @returns {object} metadata of RegisteredServer + * + */ + mapper() { + return { + required: false, + serializedName: 'RegisteredServer', + type: { + name: 'Composite', + className: 'RegisteredServer', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + serverCertificate: { + required: false, + serializedName: 'properties.serverCertificate', + type: { + name: 'String' + } + }, + agentVersion: { + required: false, + serializedName: 'properties.agentVersion', + type: { + name: 'String' + } + }, + serverOSVersion: { + required: false, + serializedName: 'properties.serverOSVersion', + type: { + name: 'String' + } + }, + serverManagementtErrorCode: { + required: false, + serializedName: 'properties.serverManagementtErrorCode', + type: { + name: 'Number' + } + }, + lastHeartBeat: { + required: false, + serializedName: 'properties.lastHeartBeat', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + serverRole: { + required: false, + serializedName: 'properties.serverRole', + type: { + name: 'String' + } + }, + clusterId: { + required: false, + serializedName: 'properties.clusterId', + type: { + name: 'String' + } + }, + clusterName: { + required: false, + serializedName: 'properties.clusterName', + type: { + name: 'String' + } + }, + serverId: { + required: false, + serializedName: 'properties.serverId', + type: { + name: 'String' + } + }, + storageSyncServiceUid: { + required: false, + serializedName: 'properties.storageSyncServiceUid', + type: { + name: 'String' + } + }, + lastWorkflowId: { + required: false, + serializedName: 'properties.lastWorkflowId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RegisteredServer; diff --git a/lib/services/storagesyncManagement/lib/models/registeredServerArray.js b/lib/services/storagesyncManagement/lib/models/registeredServerArray.js new file mode 100644 index 0000000000..aa08378a41 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/registeredServerArray.js @@ -0,0 +1,59 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Array of RegisteredServer + */ +class RegisteredServerArray extends Array { + /** + * Create a RegisteredServerArray. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of RegisteredServerArray + * + * @returns {object} metadata of RegisteredServerArray + * + */ + mapper() { + return { + required: false, + serializedName: 'RegisteredServerArray', + type: { + name: 'Composite', + className: 'RegisteredServerArray', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'RegisteredServerElementType', + type: { + name: 'Composite', + className: 'RegisteredServer' + } + } + } + } + } + } + }; + } +} + +module.exports = RegisteredServerArray; diff --git a/lib/services/storagesyncManagement/lib/models/resource.js b/lib/services/storagesyncManagement/lib/models/resource.js new file mode 100644 index 0000000000..41b5d5e0a9 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/resource.js @@ -0,0 +1,75 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The Azure Resource Manager resource. + * + * @extends models['BaseResource'] + */ +class Resource extends models['BaseResource'] { + /** + * Create a Resource. + * @member {string} [id] The id of the resource. + * @member {string} [name] The name of the resource. + * @member {string} [type] The type of the resource + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Resource + * + * @returns {object} metadata of Resource + * + */ + mapper() { + return { + required: false, + serializedName: 'Resource', + type: { + name: 'Composite', + className: 'Resource', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Resource; diff --git a/lib/services/storagesyncManagement/lib/models/resourcesMoveInfo.js b/lib/services/storagesyncManagement/lib/models/resourcesMoveInfo.js new file mode 100644 index 0000000000..a7b26c132f --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/resourcesMoveInfo.js @@ -0,0 +1,67 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Resource Move Info. + * + */ +class ResourcesMoveInfo { + /** + * Create a ResourcesMoveInfo. + * @member {string} [targetResourceGroup] Target resource group. + * @member {array} [resources] Collection of Resources. + */ + constructor() { + } + + /** + * Defines the metadata of ResourcesMoveInfo + * + * @returns {object} metadata of ResourcesMoveInfo + * + */ + mapper() { + return { + required: false, + serializedName: 'ResourcesMoveInfo', + type: { + name: 'Composite', + className: 'ResourcesMoveInfo', + modelProperties: { + targetResourceGroup: { + required: false, + serializedName: 'targetResourceGroup', + type: { + name: 'String' + } + }, + resources: { + required: false, + serializedName: 'resources', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = ResourcesMoveInfo; diff --git a/lib/services/storagesyncManagement/lib/models/restoreFileSpec.js b/lib/services/storagesyncManagement/lib/models/restoreFileSpec.js new file mode 100644 index 0000000000..f791076a15 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/restoreFileSpec.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'; + +/** + * Restore file spec. + * + */ +class RestoreFileSpec { + /** + * Create a RestoreFileSpec. + * @member {string} [path] Restore file spec path + * @member {boolean} [isdir] Restore file spec isdir + */ + constructor() { + } + + /** + * Defines the metadata of RestoreFileSpec + * + * @returns {object} metadata of RestoreFileSpec + * + */ + mapper() { + return { + required: false, + serializedName: 'RestoreFileSpec', + type: { + name: 'Composite', + className: 'RestoreFileSpec', + modelProperties: { + path: { + required: false, + serializedName: 'path', + type: { + name: 'String' + } + }, + isdir: { + required: false, + serializedName: 'isdir', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = RestoreFileSpec; diff --git a/lib/services/storagesyncManagement/lib/models/serverEndpoint.js b/lib/services/storagesyncManagement/lib/models/serverEndpoint.js new file mode 100644 index 0000000000..974b6dea4f --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/serverEndpoint.js @@ -0,0 +1,216 @@ +/* + * 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'); + +/** + * Server Endpoint object. + * + * @extends models['BaseResource'] + */ +class ServerEndpoint extends models['BaseResource'] { + /** + * Create a ServerEndpoint. + * @member {string} [serverLocalPath] Server Local path. + * @member {string} [cloudTiering] Cloud Tiering. Possible values include: + * 'on', 'off' + * @member {number} [volumeFreeSpacePercent] Level of free space to be + * maintained by Cloud Tiering if it is enabled. + * @member {string} [friendlyName] Friendly Name + * @member {date} [lastSyncSuccess] Last Sync Success + * @member {string} [syncErrorState] Sync Error State + * @member {date} [syncErrorStateTimestamp] Sync Error State Timestamp + * @member {string} [syncErrorDirection] Sync Error Direction. Possible + * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * @member {number} [itemUploadErrorCount] Item Upload Error Count. + * @member {number} [itemDownloadErrorCount] Item download error count. + * @member {string} [syncErrorContext] sync error context. + * @member {string} [currentProgressType] current progress type. Possible + * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * @member {number} [itemProgressCount] Item Progress Count + * @member {number} [itemTotalCount] Item Total Count + * @member {number} [byteProgress] Bytes in progress + * @member {number} [totalProgress] Total progress + * @member {number} [byteTotal] Bytes total + * @member {string} [serverResourceId] Server Resource Id. + * @member {string} [provisioningState] ServerEndpoint Provisioning State + * @member {string} [lastWorkflowId] ServerEndpoint lastWorkflowId + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ServerEndpoint + * + * @returns {object} metadata of ServerEndpoint + * + */ + mapper() { + return { + required: false, + serializedName: 'ServerEndpoint', + type: { + name: 'Composite', + className: 'ServerEndpoint', + modelProperties: { + serverLocalPath: { + required: false, + serializedName: 'properties.serverLocalPath', + type: { + name: 'String' + } + }, + cloudTiering: { + required: false, + serializedName: 'properties.cloudTiering', + type: { + name: 'String' + } + }, + volumeFreeSpacePercent: { + required: false, + serializedName: 'properties.volumeFreeSpacePercent', + constraints: { + InclusiveMaximum: 100, + InclusiveMinimum: 0 + }, + type: { + name: 'Number' + } + }, + friendlyName: { + required: false, + serializedName: 'properties.friendlyName', + type: { + name: 'String' + } + }, + lastSyncSuccess: { + required: false, + serializedName: 'properties.lastSyncSuccess', + type: { + name: 'DateTime' + } + }, + syncErrorState: { + required: false, + serializedName: 'properties.syncErrorState', + type: { + name: 'String' + } + }, + syncErrorStateTimestamp: { + required: false, + serializedName: 'properties.syncErrorStateTimestamp', + type: { + name: 'DateTime' + } + }, + syncErrorDirection: { + required: false, + serializedName: 'properties.syncErrorDirection', + type: { + name: 'String' + } + }, + itemUploadErrorCount: { + required: false, + serializedName: 'properties.itemUploadErrorCount', + type: { + name: 'Number' + } + }, + itemDownloadErrorCount: { + required: false, + serializedName: 'properties.itemDownloadErrorCount', + type: { + name: 'Number' + } + }, + syncErrorContext: { + required: false, + serializedName: 'properties.syncErrorContext', + type: { + name: 'String' + } + }, + currentProgressType: { + required: false, + serializedName: 'properties.currentProgressType', + type: { + name: 'String' + } + }, + itemProgressCount: { + required: false, + serializedName: 'properties.itemProgressCount', + type: { + name: 'Number' + } + }, + itemTotalCount: { + required: false, + serializedName: 'properties.itemTotalCount', + type: { + name: 'Number' + } + }, + byteProgress: { + required: false, + serializedName: 'properties.byteProgress', + type: { + name: 'Number' + } + }, + totalProgress: { + required: false, + serializedName: 'properties.totalProgress', + type: { + name: 'Number' + } + }, + byteTotal: { + required: false, + serializedName: 'properties.byteTotal', + type: { + name: 'Number' + } + }, + serverResourceId: { + required: false, + serializedName: 'properties.serverResourceId', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + lastWorkflowId: { + required: false, + serializedName: 'properties.lastWorkflowId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ServerEndpoint; diff --git a/lib/services/storagesyncManagement/lib/models/serverEndpointArray.js b/lib/services/storagesyncManagement/lib/models/serverEndpointArray.js new file mode 100644 index 0000000000..3313291c3a --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/serverEndpointArray.js @@ -0,0 +1,59 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Array of ServerEndpoint + */ +class ServerEndpointArray extends Array { + /** + * Create a ServerEndpointArray. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ServerEndpointArray + * + * @returns {object} metadata of ServerEndpointArray + * + */ + mapper() { + return { + required: false, + serializedName: 'ServerEndpointArray', + type: { + name: 'Composite', + className: 'ServerEndpointArray', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ServerEndpointElementType', + type: { + name: 'Composite', + className: 'ServerEndpoint' + } + } + } + } + } + } + }; + } +} + +module.exports = ServerEndpointArray; diff --git a/lib/services/storagesyncManagement/lib/models/storageSyncService.js b/lib/services/storagesyncManagement/lib/models/storageSyncService.js new file mode 100644 index 0000000000..f6b979f943 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/storageSyncService.js @@ -0,0 +1,66 @@ +/* + * 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'); + +/** + * Storage Sync Service object. + * + * @extends models['BaseResource'] + */ +class StorageSyncService extends models['BaseResource'] { + /** + * Create a StorageSyncService. + * @member {number} [storageSyncServiceStatus] Storage Sync service status. + * @member {string} [storageSyncServiceUid] Storage Sync service Uid + */ + constructor() { + super(); + } + + /** + * Defines the metadata of StorageSyncService + * + * @returns {object} metadata of StorageSyncService + * + */ + mapper() { + return { + required: false, + serializedName: 'StorageSyncService', + type: { + name: 'Composite', + className: 'StorageSyncService', + modelProperties: { + storageSyncServiceStatus: { + required: false, + readOnly: true, + serializedName: 'properties.storageSyncServiceStatus', + type: { + name: 'Number' + } + }, + storageSyncServiceUid: { + required: false, + readOnly: true, + serializedName: 'properties.storageSyncServiceUid', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = StorageSyncService; diff --git a/lib/services/storagesyncManagement/lib/models/storageSyncServiceArray.js b/lib/services/storagesyncManagement/lib/models/storageSyncServiceArray.js new file mode 100644 index 0000000000..1886f79e23 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/storageSyncServiceArray.js @@ -0,0 +1,59 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Array of StorageSyncServices + */ +class StorageSyncServiceArray extends Array { + /** + * Create a StorageSyncServiceArray. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of StorageSyncServiceArray + * + * @returns {object} metadata of StorageSyncServiceArray + * + */ + mapper() { + return { + required: false, + serializedName: 'StorageSyncServiceArray', + type: { + name: 'Composite', + className: 'StorageSyncServiceArray', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StorageSyncServiceElementType', + type: { + name: 'Composite', + className: 'StorageSyncService' + } + } + } + } + } + } + }; + } +} + +module.exports = StorageSyncServiceArray; diff --git a/lib/services/storagesyncManagement/lib/models/subscriptionState.js b/lib/services/storagesyncManagement/lib/models/subscriptionState.js new file mode 100644 index 0000000000..43bd80ec08 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/subscriptionState.js @@ -0,0 +1,69 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Subscription State object. + * + */ +class SubscriptionState { + /** + * Create a SubscriptionState. + * @member {string} [state] State of Azure Subscription. Possible values + * include: 'Registered', 'Unregistered', 'Warned', 'Suspended', 'Deleted' + * @member {boolean} [istransitioning] Is Transitioning + * @member {object} [properties] Subscription state properties. + */ + constructor() { + } + + /** + * Defines the metadata of SubscriptionState + * + * @returns {object} metadata of SubscriptionState + * + */ + mapper() { + return { + required: false, + serializedName: 'SubscriptionState', + type: { + name: 'Composite', + className: 'SubscriptionState', + modelProperties: { + state: { + required: false, + serializedName: 'state', + type: { + name: 'String' + } + }, + istransitioning: { + required: false, + serializedName: 'istransitioning', + type: { + name: 'Boolean' + } + }, + properties: { + required: false, + serializedName: 'properties', + type: { + name: 'Object' + } + } + } + } + }; + } +} + +module.exports = SubscriptionState; diff --git a/lib/services/storagesyncManagement/lib/models/syncGroup.js b/lib/services/storagesyncManagement/lib/models/syncGroup.js new file mode 100644 index 0000000000..37720481d2 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/syncGroup.js @@ -0,0 +1,65 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Sync Group object. + * + * @extends models['BaseResource'] + */ +class SyncGroup extends models['BaseResource'] { + /** + * Create a SyncGroup. + * @member {string} [uniqueId] Unique Id + * @member {string} [syncGroupStatus] Sync group status + */ + constructor() { + super(); + } + + /** + * Defines the metadata of SyncGroup + * + * @returns {object} metadata of SyncGroup + * + */ + mapper() { + return { + required: false, + serializedName: 'SyncGroup', + type: { + name: 'Composite', + className: 'SyncGroup', + modelProperties: { + uniqueId: { + required: false, + serializedName: 'properties.uniqueId', + type: { + name: 'String' + } + }, + syncGroupStatus: { + required: false, + readOnly: true, + serializedName: 'properties.syncGroupStatus', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SyncGroup; diff --git a/lib/services/storagesyncManagement/lib/models/syncGroupArray.js b/lib/services/storagesyncManagement/lib/models/syncGroupArray.js new file mode 100644 index 0000000000..cc7e29f5cc --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/syncGroupArray.js @@ -0,0 +1,59 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Array of SyncGroup + */ +class SyncGroupArray extends Array { + /** + * Create a SyncGroupArray. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of SyncGroupArray + * + * @returns {object} metadata of SyncGroupArray + * + */ + mapper() { + return { + required: false, + serializedName: 'SyncGroupArray', + type: { + name: 'Composite', + className: 'SyncGroupArray', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SyncGroupElementType', + type: { + name: 'Composite', + className: 'SyncGroup' + } + } + } + } + } + } + }; + } +} + +module.exports = SyncGroupArray; diff --git a/lib/services/storagesyncManagement/lib/models/trackedResource.js b/lib/services/storagesyncManagement/lib/models/trackedResource.js new file mode 100644 index 0000000000..1daf584523 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/trackedResource.js @@ -0,0 +1,88 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * ARM tracked resource + * + * @extends models['Resource'] + */ +class TrackedResource extends models['Resource'] { + /** + * Create a TrackedResource. + * @member {string} [location] The location of the resource. + * @member {object} [tags] The tags of the resource. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of TrackedResource + * + * @returns {object} metadata of TrackedResource + * + */ + mapper() { + return { + required: false, + serializedName: 'TrackedResource', + type: { + name: 'Composite', + className: 'TrackedResource', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Object' + } + } + } + } + }; + } +} + +module.exports = TrackedResource; diff --git a/lib/services/storagesyncManagement/lib/models/workflow.js b/lib/services/storagesyncManagement/lib/models/workflow.js new file mode 100644 index 0000000000..5e92ffff83 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/workflow.js @@ -0,0 +1,90 @@ +/* + * 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'); + +/** + * Workflow resource. + * + * @extends models['BaseResource'] + */ +class Workflow extends models['BaseResource'] { + /** + * Create a Workflow. + * @member {string} [lastStepName] last step name + * @member {string} [status] workflow status. Possible values include: + * 'active', 'expired', 'succeeded', 'aborted', 'failed' + * @member {string} [operation] operation direction. Possible values include: + * 'do', 'undo', 'cancel' + * @member {string} [steps] workflow steps + * @member {string} [lastOperationId] workflow last operation identifier. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Workflow + * + * @returns {object} metadata of Workflow + * + */ + mapper() { + return { + required: false, + serializedName: 'Workflow', + type: { + name: 'Composite', + className: 'Workflow', + modelProperties: { + lastStepName: { + required: false, + serializedName: 'properties.lastStepName', + type: { + name: 'String' + } + }, + status: { + required: false, + serializedName: 'properties.status', + type: { + name: 'String' + } + }, + operation: { + required: false, + serializedName: 'properties.operation', + type: { + name: 'String' + } + }, + steps: { + required: false, + serializedName: 'properties.steps', + type: { + name: 'String' + } + }, + lastOperationId: { + required: false, + serializedName: 'properties.lastOperationId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Workflow; diff --git a/lib/services/storagesyncManagement/lib/models/workflowArray.js b/lib/services/storagesyncManagement/lib/models/workflowArray.js new file mode 100644 index 0000000000..698149ba59 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/workflowArray.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'); + +/** + * Array of Workflow + * + */ +class WorkflowArray { + /** + * Create a WorkflowArray. + * @member {array} [value] Collection of workflow items. + */ + constructor() { + } + + /** + * Defines the metadata of WorkflowArray + * + * @returns {object} metadata of WorkflowArray + * + */ + mapper() { + return { + required: false, + serializedName: 'WorkflowArray', + type: { + name: 'Composite', + className: 'WorkflowArray', + modelProperties: { + value: { + required: false, + serializedName: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'WorkflowElementType', + type: { + name: 'Composite', + className: 'Workflow' + } + } + } + } + } + } + }; + } +} + +module.exports = WorkflowArray; diff --git a/lib/services/storagesyncManagement/lib/operations/abortWorkflows.js b/lib/services/storagesyncManagement/lib/operations/abortWorkflows.js new file mode 100644 index 0000000000..4da18b23b5 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/abortWorkflows.js @@ -0,0 +1,273 @@ +/* + * 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; + +/** + * Abort the given workflow. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} workflowId workflow Id + * + * @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 _post(resourceGroupName, storageSyncServiceName, workflowId, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName cannot be null or undefined and it must be of type string.'); + } + if (workflowId === null || workflowId === undefined || typeof workflowId.valueOf() !== 'string') { + throw new Error('workflowId 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.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows/{workflowId}/abort'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + requestUrl = requestUrl.replace('{workflowId}', encodeURIComponent(workflowId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['ErrorModel']().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 AbortWorkflows. */ +class AbortWorkflows { + /** + * Create a AbortWorkflows. + * @param {MicrosoftStorageSync} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._post = _post; + } + + /** + * Abort the given workflow. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} workflowId workflow Id + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + postWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, workflowId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._post(resourceGroupName, storageSyncServiceName, workflowId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Abort the given workflow. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} workflowId workflow Id + * + * @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. + */ + post(resourceGroupName, storageSyncServiceName, workflowId, 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._post(resourceGroupName, storageSyncServiceName, workflowId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._post(resourceGroupName, storageSyncServiceName, workflowId, options, optionalCallback); + } + } + +} + +module.exports = AbortWorkflows; diff --git a/lib/services/storagesyncManagement/lib/operations/cloudEndpointPostBackup.js b/lib/services/storagesyncManagement/lib/operations/cloudEndpointPostBackup.js new file mode 100644 index 0000000000..e8d0a62753 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/cloudEndpointPostBackup.js @@ -0,0 +1,526 @@ +/* + * 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; + + +/** + * Post Backup a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * + * @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 PostBackupResponse} 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 _post(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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.beginPost(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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['PostBackupResponse']().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); + }); + }); +} + +/** + * Post Backup a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * + * @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 PostBackupResponse} 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 _beginPost(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName cannot be null or undefined and it must be of type string.'); + } + if (syncGroupName === null || syncGroupName === undefined || typeof syncGroupName.valueOf() !== 'string') { + throw new Error('syncGroupName cannot be null or undefined and it must be of type string.'); + } + if (cloudEndpointName === null || cloudEndpointName === undefined || typeof cloudEndpointName.valueOf() !== 'string') { + throw new Error('cloudEndpointName cannot be null or undefined and it must be of type string.'); + } + if (body === null || body === undefined) { + throw new Error('body 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.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postbackup'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + requestUrl = requestUrl.replace('{syncGroupName}', encodeURIComponent(syncGroupName)); + requestUrl = requestUrl.replace('{cloudEndpointName}', encodeURIComponent(cloudEndpointName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (body !== null && body !== undefined) { + let requestModelMapper = new client.models['BackupRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, body, 'body'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(body, 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['ErrorModel']().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['PostBackupResponse']().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 CloudEndpointPostBackup. */ +class CloudEndpointPostBackup { + /** + * Create a CloudEndpointPostBackup. + * @param {MicrosoftStorageSync} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._post = _post; + this._beginPost = _beginPost; + } + + /** + * Post Backup a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + postWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._post(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Post Backup a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * + * @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 {PostBackupResponse} - 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 PostBackupResponse} 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. + */ + post(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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._post(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._post(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback); + } + } + + /** + * Post Backup a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + beginPostWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginPost(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Post Backup a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * + * @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 {PostBackupResponse} - 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 PostBackupResponse} 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. + */ + beginPost(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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._beginPost(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginPost(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback); + } + } + +} + +module.exports = CloudEndpointPostBackup; diff --git a/lib/services/storagesyncManagement/lib/operations/cloudEndpointPostRestore.js b/lib/services/storagesyncManagement/lib/operations/cloudEndpointPostRestore.js new file mode 100644 index 0000000000..46e09ceebf --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/cloudEndpointPostRestore.js @@ -0,0 +1,581 @@ +/* + * 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; + + +/** + * Post Restore a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint object. + * + * @param {string} [body.partition] Post Restore partition. + * + * @param {string} [body.replicaGroup] Post Restore replica group. + * + * @param {string} [body.requestId] Post Restore request id. + * + * @param {string} [body.azureFileShareUri] Post Restore Azure file share uri. + * + * @param {string} [body.status] Post Restore Azure status. + * + * @param {string} [body.sourceAzureFileShareUri] Post Restore Azure source + * azure file share uri. + * + * @param {string} [body.failedFileList] Post Restore Azure failed file list. + * + * @param {array} [body.restoreFileSpec] Post Restore restore file spec array. + * + * @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 _post(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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.beginPost(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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); + }); + }); +} + +/** + * Post Restore a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint object. + * + * @param {string} [body.partition] Post Restore partition. + * + * @param {string} [body.replicaGroup] Post Restore replica group. + * + * @param {string} [body.requestId] Post Restore request id. + * + * @param {string} [body.azureFileShareUri] Post Restore Azure file share uri. + * + * @param {string} [body.status] Post Restore Azure status. + * + * @param {string} [body.sourceAzureFileShareUri] Post Restore Azure source + * azure file share uri. + * + * @param {string} [body.failedFileList] Post Restore Azure failed file list. + * + * @param {array} [body.restoreFileSpec] Post Restore restore file spec array. + * + * @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 _beginPost(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName cannot be null or undefined and it must be of type string.'); + } + if (syncGroupName === null || syncGroupName === undefined || typeof syncGroupName.valueOf() !== 'string') { + throw new Error('syncGroupName cannot be null or undefined and it must be of type string.'); + } + if (cloudEndpointName === null || cloudEndpointName === undefined || typeof cloudEndpointName.valueOf() !== 'string') { + throw new Error('cloudEndpointName cannot be null or undefined and it must be of type string.'); + } + if (body === null || body === undefined) { + throw new Error('body 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.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postrestore'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + requestUrl = requestUrl.replace('{syncGroupName}', encodeURIComponent(syncGroupName)); + requestUrl = requestUrl.replace('{cloudEndpointName}', encodeURIComponent(cloudEndpointName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (body !== null && body !== undefined) { + let requestModelMapper = new client.models['PostRestoreRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, body, 'body'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(body, 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['ErrorModel']().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 CloudEndpointPostRestore. */ +class CloudEndpointPostRestore { + /** + * Create a CloudEndpointPostRestore. + * @param {MicrosoftStorageSync} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._post = _post; + this._beginPost = _beginPost; + } + + /** + * Post Restore a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint object. + * + * @param {string} [body.partition] Post Restore partition. + * + * @param {string} [body.replicaGroup] Post Restore replica group. + * + * @param {string} [body.requestId] Post Restore request id. + * + * @param {string} [body.azureFileShareUri] Post Restore Azure file share uri. + * + * @param {string} [body.status] Post Restore Azure status. + * + * @param {string} [body.sourceAzureFileShareUri] Post Restore Azure source + * azure file share uri. + * + * @param {string} [body.failedFileList] Post Restore Azure failed file list. + * + * @param {array} [body.restoreFileSpec] Post Restore restore file spec array. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + postWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._post(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Post Restore a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint object. + * + * @param {string} [body.partition] Post Restore partition. + * + * @param {string} [body.replicaGroup] Post Restore replica group. + * + * @param {string} [body.requestId] Post Restore request id. + * + * @param {string} [body.azureFileShareUri] Post Restore Azure file share uri. + * + * @param {string} [body.status] Post Restore Azure status. + * + * @param {string} [body.sourceAzureFileShareUri] Post Restore Azure source + * azure file share uri. + * + * @param {string} [body.failedFileList] Post Restore Azure failed file list. + * + * @param {array} [body.restoreFileSpec] Post Restore restore file spec array. + * + * @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. + */ + post(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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._post(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._post(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback); + } + } + + /** + * Post Restore a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint object. + * + * @param {string} [body.partition] Post Restore partition. + * + * @param {string} [body.replicaGroup] Post Restore replica group. + * + * @param {string} [body.requestId] Post Restore request id. + * + * @param {string} [body.azureFileShareUri] Post Restore Azure file share uri. + * + * @param {string} [body.status] Post Restore Azure status. + * + * @param {string} [body.sourceAzureFileShareUri] Post Restore Azure source + * azure file share uri. + * + * @param {string} [body.failedFileList] Post Restore Azure failed file list. + * + * @param {array} [body.restoreFileSpec] Post Restore restore file spec array. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + beginPostWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginPost(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Post Restore a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint object. + * + * @param {string} [body.partition] Post Restore partition. + * + * @param {string} [body.replicaGroup] Post Restore replica group. + * + * @param {string} [body.requestId] Post Restore request id. + * + * @param {string} [body.azureFileShareUri] Post Restore Azure file share uri. + * + * @param {string} [body.status] Post Restore Azure status. + * + * @param {string} [body.sourceAzureFileShareUri] Post Restore Azure source + * azure file share uri. + * + * @param {string} [body.failedFileList] Post Restore Azure failed file list. + * + * @param {array} [body.restoreFileSpec] Post Restore restore file spec array. + * + * @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. + */ + beginPost(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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._beginPost(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginPost(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback); + } + } + +} + +module.exports = CloudEndpointPostRestore; diff --git a/lib/services/storagesyncManagement/lib/operations/cloudEndpointPreBackup.js b/lib/services/storagesyncManagement/lib/operations/cloudEndpointPreBackup.js new file mode 100644 index 0000000000..fc0b51f0c0 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/cloudEndpointPreBackup.js @@ -0,0 +1,491 @@ +/* + * 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; + + +/** + * Pre Backup a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * + * @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 _post(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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.beginPost(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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); + }); + }); +} + +/** + * Pre Backup a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * + * @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 _beginPost(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName cannot be null or undefined and it must be of type string.'); + } + if (syncGroupName === null || syncGroupName === undefined || typeof syncGroupName.valueOf() !== 'string') { + throw new Error('syncGroupName cannot be null or undefined and it must be of type string.'); + } + if (cloudEndpointName === null || cloudEndpointName === undefined || typeof cloudEndpointName.valueOf() !== 'string') { + throw new Error('cloudEndpointName cannot be null or undefined and it must be of type string.'); + } + if (body === null || body === undefined) { + throw new Error('body 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.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prebackup'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + requestUrl = requestUrl.replace('{syncGroupName}', encodeURIComponent(syncGroupName)); + requestUrl = requestUrl.replace('{cloudEndpointName}', encodeURIComponent(cloudEndpointName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (body !== null && body !== undefined) { + let requestModelMapper = new client.models['BackupRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, body, 'body'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(body, 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['ErrorModel']().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 CloudEndpointPreBackup. */ +class CloudEndpointPreBackup { + /** + * Create a CloudEndpointPreBackup. + * @param {MicrosoftStorageSync} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._post = _post; + this._beginPost = _beginPost; + } + + /** + * Pre Backup a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + postWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._post(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Pre Backup a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * + * @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. + */ + post(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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._post(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._post(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback); + } + } + + /** + * Pre Backup a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + beginPostWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginPost(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Pre Backup a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * + * @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. + */ + beginPost(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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._beginPost(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginPost(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback); + } + } + +} + +module.exports = CloudEndpointPreBackup; diff --git a/lib/services/storagesyncManagement/lib/operations/cloudEndpointPreRestore.js b/lib/services/storagesyncManagement/lib/operations/cloudEndpointPreRestore.js new file mode 100644 index 0000000000..d1ab455b76 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/cloudEndpointPreRestore.js @@ -0,0 +1,605 @@ +/* + * 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; + + +/** + * Pre Restore a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint object. + * + * @param {string} [body.partition] Pre Restore partition. + * + * @param {string} [body.replicaGroup] Pre Restore replica group. + * + * @param {string} [body.requestId] Pre Restore request id. + * + * @param {string} [body.azureFileShareUri] Pre Restore Azure file share uri. + * + * @param {string} [body.status] Pre Restore Azure status. + * + * @param {string} [body.sourceAzureFileShareUri] Pre Restore Azure source + * azure file share uri. + * + * @param {string} [body.backupMetadataPropertyBag] Pre Restore backup metadata + * property bag. + * + * @param {array} [body.restoreFileSpec] Pre Restore restore file spec array. + * + * @param {number} [body.pausewaitforsyncdraintimeperiodinseconds] Pre Restore + * pause wait for sync drain time period in seconds. + * + * @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 _post(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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.beginPost(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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); + }); + }); +} + +/** + * Pre Restore a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint object. + * + * @param {string} [body.partition] Pre Restore partition. + * + * @param {string} [body.replicaGroup] Pre Restore replica group. + * + * @param {string} [body.requestId] Pre Restore request id. + * + * @param {string} [body.azureFileShareUri] Pre Restore Azure file share uri. + * + * @param {string} [body.status] Pre Restore Azure status. + * + * @param {string} [body.sourceAzureFileShareUri] Pre Restore Azure source + * azure file share uri. + * + * @param {string} [body.backupMetadataPropertyBag] Pre Restore backup metadata + * property bag. + * + * @param {array} [body.restoreFileSpec] Pre Restore restore file spec array. + * + * @param {number} [body.pausewaitforsyncdraintimeperiodinseconds] Pre Restore + * pause wait for sync drain time period in seconds. + * + * @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 _beginPost(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName cannot be null or undefined and it must be of type string.'); + } + if (syncGroupName === null || syncGroupName === undefined || typeof syncGroupName.valueOf() !== 'string') { + throw new Error('syncGroupName cannot be null or undefined and it must be of type string.'); + } + if (cloudEndpointName === null || cloudEndpointName === undefined || typeof cloudEndpointName.valueOf() !== 'string') { + throw new Error('cloudEndpointName cannot be null or undefined and it must be of type string.'); + } + if (body === null || body === undefined) { + throw new Error('body 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.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prerestore'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + requestUrl = requestUrl.replace('{syncGroupName}', encodeURIComponent(syncGroupName)); + requestUrl = requestUrl.replace('{cloudEndpointName}', encodeURIComponent(cloudEndpointName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (body !== null && body !== undefined) { + let requestModelMapper = new client.models['PreRestoreRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, body, 'body'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(body, 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['ErrorModel']().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 CloudEndpointPreRestore. */ +class CloudEndpointPreRestore { + /** + * Create a CloudEndpointPreRestore. + * @param {MicrosoftStorageSync} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._post = _post; + this._beginPost = _beginPost; + } + + /** + * Pre Restore a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint object. + * + * @param {string} [body.partition] Pre Restore partition. + * + * @param {string} [body.replicaGroup] Pre Restore replica group. + * + * @param {string} [body.requestId] Pre Restore request id. + * + * @param {string} [body.azureFileShareUri] Pre Restore Azure file share uri. + * + * @param {string} [body.status] Pre Restore Azure status. + * + * @param {string} [body.sourceAzureFileShareUri] Pre Restore Azure source + * azure file share uri. + * + * @param {string} [body.backupMetadataPropertyBag] Pre Restore backup metadata + * property bag. + * + * @param {array} [body.restoreFileSpec] Pre Restore restore file spec array. + * + * @param {number} [body.pausewaitforsyncdraintimeperiodinseconds] Pre Restore + * pause wait for sync drain time period in seconds. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + postWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._post(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Pre Restore a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint object. + * + * @param {string} [body.partition] Pre Restore partition. + * + * @param {string} [body.replicaGroup] Pre Restore replica group. + * + * @param {string} [body.requestId] Pre Restore request id. + * + * @param {string} [body.azureFileShareUri] Pre Restore Azure file share uri. + * + * @param {string} [body.status] Pre Restore Azure status. + * + * @param {string} [body.sourceAzureFileShareUri] Pre Restore Azure source + * azure file share uri. + * + * @param {string} [body.backupMetadataPropertyBag] Pre Restore backup metadata + * property bag. + * + * @param {array} [body.restoreFileSpec] Pre Restore restore file spec array. + * + * @param {number} [body.pausewaitforsyncdraintimeperiodinseconds] Pre Restore + * pause wait for sync drain time period in seconds. + * + * @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. + */ + post(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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._post(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._post(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback); + } + } + + /** + * Pre Restore a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint object. + * + * @param {string} [body.partition] Pre Restore partition. + * + * @param {string} [body.replicaGroup] Pre Restore replica group. + * + * @param {string} [body.requestId] Pre Restore request id. + * + * @param {string} [body.azureFileShareUri] Pre Restore Azure file share uri. + * + * @param {string} [body.status] Pre Restore Azure status. + * + * @param {string} [body.sourceAzureFileShareUri] Pre Restore Azure source + * azure file share uri. + * + * @param {string} [body.backupMetadataPropertyBag] Pre Restore backup metadata + * property bag. + * + * @param {array} [body.restoreFileSpec] Pre Restore restore file spec array. + * + * @param {number} [body.pausewaitforsyncdraintimeperiodinseconds] Pre Restore + * pause wait for sync drain time period in seconds. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + beginPostWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginPost(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Pre Restore a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint object. + * + * @param {string} [body.partition] Pre Restore partition. + * + * @param {string} [body.replicaGroup] Pre Restore replica group. + * + * @param {string} [body.requestId] Pre Restore request id. + * + * @param {string} [body.azureFileShareUri] Pre Restore Azure file share uri. + * + * @param {string} [body.status] Pre Restore Azure status. + * + * @param {string} [body.sourceAzureFileShareUri] Pre Restore Azure source + * azure file share uri. + * + * @param {string} [body.backupMetadataPropertyBag] Pre Restore backup metadata + * property bag. + * + * @param {array} [body.restoreFileSpec] Pre Restore restore file spec array. + * + * @param {number} [body.pausewaitforsyncdraintimeperiodinseconds] Pre Restore + * pause wait for sync drain time period in seconds. + * + * @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. + */ + beginPost(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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._beginPost(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginPost(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback); + } + } + +} + +module.exports = CloudEndpointPreRestore; diff --git a/lib/services/storagesyncManagement/lib/operations/cloudEndpointRestoreHeatbeat.js b/lib/services/storagesyncManagement/lib/operations/cloudEndpointRestoreHeatbeat.js new file mode 100644 index 0000000000..f0ba51e445 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/cloudEndpointRestoreHeatbeat.js @@ -0,0 +1,283 @@ +/* + * 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; + +/** + * Restore Heartbeat a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @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 _post(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName cannot be null or undefined and it must be of type string.'); + } + if (syncGroupName === null || syncGroupName === undefined || typeof syncGroupName.valueOf() !== 'string') { + throw new Error('syncGroupName cannot be null or undefined and it must be of type string.'); + } + if (cloudEndpointName === null || cloudEndpointName === undefined || typeof cloudEndpointName.valueOf() !== 'string') { + throw new Error('cloudEndpointName 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.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/restoreheartbeat'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + requestUrl = requestUrl.replace('{syncGroupName}', encodeURIComponent(syncGroupName)); + requestUrl = requestUrl.replace('{cloudEndpointName}', encodeURIComponent(cloudEndpointName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['ErrorModel']().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 CloudEndpointRestoreHeatbeat. */ +class CloudEndpointRestoreHeatbeat { + /** + * Create a CloudEndpointRestoreHeatbeat. + * @param {MicrosoftStorageSync} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._post = _post; + } + + /** + * Restore Heartbeat a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + postWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._post(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Restore Heartbeat a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @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. + */ + post(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, 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._post(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._post(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, optionalCallback); + } + } + +} + +module.exports = CloudEndpointRestoreHeatbeat; diff --git a/lib/services/storagesyncManagement/lib/operations/cloudEndpoints.js b/lib/services/storagesyncManagement/lib/operations/cloudEndpoints.js new file mode 100644 index 0000000000..0e2a984c9f --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/cloudEndpoints.js @@ -0,0 +1,1328 @@ +/* + * 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; + + +/** + * Create a new CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint resource. + * + * @param {string} [body.storageAccountKey] Storage Account access key. + * + * @param {string} [body.storageAccount] Storage Account name. + * + * @param {string} [body.storageAccountResourceId] Storage Account Resource Id + * + * @param {string} [body.storageAccountShareName] Storage Account Share name + * + * @param {string} [body.storageAccountTenantId] Storage Account Tenant Id + * + * @param {string} [body.partnershipId] Partnership Id + * + * @param {string} [body.friendlyName] Friendly Name + * + * @param {boolean} [body.backupEnabled] Backup Enabled + * + * @param {string} [body.provisioningState] CloudEndpoint Provisioning State + * + * @param {string} [body.lastWorkflowId] CloudEndpoint lastWorkflowId + * + * @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 CloudEndpoint} 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 _create(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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['CloudEndpoint']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Get a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @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 CloudEndpoint} 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, storageSyncServiceName, syncGroupName, cloudEndpointName, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName cannot be null or undefined and it must be of type string.'); + } + if (syncGroupName === null || syncGroupName === undefined || typeof syncGroupName.valueOf() !== 'string') { + throw new Error('syncGroupName cannot be null or undefined and it must be of type string.'); + } + if (cloudEndpointName === null || cloudEndpointName === undefined || typeof cloudEndpointName.valueOf() !== 'string') { + throw new Error('cloudEndpointName 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.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + requestUrl = requestUrl.replace('{syncGroupName}', encodeURIComponent(syncGroupName)); + requestUrl = requestUrl.replace('{cloudEndpointName}', encodeURIComponent(cloudEndpointName)); + 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['ErrorModel']().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['CloudEndpoint']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Delete a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @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, storageSyncServiceName, syncGroupName, cloudEndpointName, 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, storageSyncServiceName, syncGroupName, cloudEndpointName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Create a new CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint resource. + * + * @param {string} [body.storageAccountKey] Storage Account access key. + * + * @param {string} [body.storageAccount] Storage Account name. + * + * @param {string} [body.storageAccountResourceId] Storage Account Resource Id + * + * @param {string} [body.storageAccountShareName] Storage Account Share name + * + * @param {string} [body.storageAccountTenantId] Storage Account Tenant Id + * + * @param {string} [body.partnershipId] Partnership Id + * + * @param {string} [body.friendlyName] Friendly Name + * + * @param {boolean} [body.backupEnabled] Backup Enabled + * + * @param {string} [body.provisioningState] CloudEndpoint Provisioning State + * + * @param {string} [body.lastWorkflowId] CloudEndpoint lastWorkflowId + * + * @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 CloudEndpoint} 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, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName cannot be null or undefined and it must be of type string.'); + } + if (syncGroupName === null || syncGroupName === undefined || typeof syncGroupName.valueOf() !== 'string') { + throw new Error('syncGroupName cannot be null or undefined and it must be of type string.'); + } + if (cloudEndpointName === null || cloudEndpointName === undefined || typeof cloudEndpointName.valueOf() !== 'string') { + throw new Error('cloudEndpointName cannot be null or undefined and it must be of type string.'); + } + if (body === null || body === undefined) { + throw new Error('body 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.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + requestUrl = requestUrl.replace('{syncGroupName}', encodeURIComponent(syncGroupName)); + requestUrl = requestUrl.replace('{cloudEndpointName}', encodeURIComponent(cloudEndpointName)); + 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 (body !== null && body !== undefined) { + let requestModelMapper = new client.models['CloudEndpoint']().mapper(); + requestModel = client.serialize(requestModelMapper, body, 'body'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(body, 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['ErrorModel']().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['CloudEndpoint']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Delete a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @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, storageSyncServiceName, syncGroupName, cloudEndpointName, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName cannot be null or undefined and it must be of type string.'); + } + if (syncGroupName === null || syncGroupName === undefined || typeof syncGroupName.valueOf() !== 'string') { + throw new Error('syncGroupName cannot be null or undefined and it must be of type string.'); + } + if (cloudEndpointName === null || cloudEndpointName === undefined || typeof cloudEndpointName.valueOf() !== 'string') { + throw new Error('cloudEndpointName 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.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + requestUrl = requestUrl.replace('{syncGroupName}', encodeURIComponent(syncGroupName)); + requestUrl = requestUrl.replace('{cloudEndpointName}', encodeURIComponent(cloudEndpointName)); + 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 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['ErrorModel']().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 CloudEndpoints. */ +class CloudEndpoints { + /** + * Create a CloudEndpoints. + * @param {MicrosoftStorageSync} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._create = _create; + this._get = _get; + this._deleteMethod = _deleteMethod; + this._beginCreate = _beginCreate; + this._beginDeleteMethod = _beginDeleteMethod; + } + + /** + * Create a new CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint resource. + * + * @param {string} [body.storageAccountKey] Storage Account access key. + * + * @param {string} [body.storageAccount] Storage Account name. + * + * @param {string} [body.storageAccountResourceId] Storage Account Resource Id + * + * @param {string} [body.storageAccountShareName] Storage Account Share name + * + * @param {string} [body.storageAccountTenantId] Storage Account Tenant Id + * + * @param {string} [body.partnershipId] Partnership Id + * + * @param {string} [body.friendlyName] Friendly Name + * + * @param {boolean} [body.backupEnabled] Backup Enabled + * + * @param {string} [body.provisioningState] CloudEndpoint Provisioning State + * + * @param {string} [body.lastWorkflowId] CloudEndpoint lastWorkflowId + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._create(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create a new CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint resource. + * + * @param {string} [body.storageAccountKey] Storage Account access key. + * + * @param {string} [body.storageAccount] Storage Account name. + * + * @param {string} [body.storageAccountResourceId] Storage Account Resource Id + * + * @param {string} [body.storageAccountShareName] Storage Account Share name + * + * @param {string} [body.storageAccountTenantId] Storage Account Tenant Id + * + * @param {string} [body.partnershipId] Partnership Id + * + * @param {string} [body.friendlyName] Friendly Name + * + * @param {boolean} [body.backupEnabled] Backup Enabled + * + * @param {string} [body.provisioningState] CloudEndpoint Provisioning State + * + * @param {string} [body.lastWorkflowId] CloudEndpoint lastWorkflowId + * + * @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 {CloudEndpoint} - 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 CloudEndpoint} 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. + */ + create(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback); + } + } + + /** + * Get a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, storageSyncServiceName, syncGroupName, cloudEndpointName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @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 {CloudEndpoint} - 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 CloudEndpoint} 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, storageSyncServiceName, syncGroupName, cloudEndpointName, 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, storageSyncServiceName, syncGroupName, cloudEndpointName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, optionalCallback); + } + } + + /** + * Delete a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, storageSyncServiceName, syncGroupName, cloudEndpointName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @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, storageSyncServiceName, syncGroupName, cloudEndpointName, 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, storageSyncServiceName, syncGroupName, cloudEndpointName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, optionalCallback); + } + } + + /** + * Create a new CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint resource. + * + * @param {string} [body.storageAccountKey] Storage Account access key. + * + * @param {string} [body.storageAccount] Storage Account name. + * + * @param {string} [body.storageAccountResourceId] Storage Account Resource Id + * + * @param {string} [body.storageAccountShareName] Storage Account Share name + * + * @param {string} [body.storageAccountTenantId] Storage Account Tenant Id + * + * @param {string} [body.partnershipId] Partnership Id + * + * @param {string} [body.friendlyName] Friendly Name + * + * @param {boolean} [body.backupEnabled] Backup Enabled + * + * @param {string} [body.provisioningState] CloudEndpoint Provisioning State + * + * @param {string} [body.lastWorkflowId] CloudEndpoint lastWorkflowId + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create a new CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint resource. + * + * @param {string} [body.storageAccountKey] Storage Account access key. + * + * @param {string} [body.storageAccount] Storage Account name. + * + * @param {string} [body.storageAccountResourceId] Storage Account Resource Id + * + * @param {string} [body.storageAccountShareName] Storage Account Share name + * + * @param {string} [body.storageAccountTenantId] Storage Account Tenant Id + * + * @param {string} [body.partnershipId] Partnership Id + * + * @param {string} [body.friendlyName] Friendly Name + * + * @param {boolean} [body.backupEnabled] Backup Enabled + * + * @param {string} [body.provisioningState] CloudEndpoint Provisioning State + * + * @param {string} [body.lastWorkflowId] CloudEndpoint lastWorkflowId + * + * @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 {CloudEndpoint} - 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 CloudEndpoint} 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, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback); + } + } + + /** + * Delete a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, storageSyncServiceName, syncGroupName, cloudEndpointName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @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, storageSyncServiceName, syncGroupName, cloudEndpointName, 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, storageSyncServiceName, syncGroupName, cloudEndpointName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, optionalCallback); + } + } + +} + +module.exports = CloudEndpoints; diff --git a/lib/services/storagesyncManagement/lib/operations/cloudEndpointsGet.js b/lib/services/storagesyncManagement/lib/operations/cloudEndpointsGet.js new file mode 100644 index 0000000000..d40658182c --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/cloudEndpointsGet.js @@ -0,0 +1,292 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Get a CloudEndpoint List. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link CloudEndpointArray} 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 _listBySyncGroup(resourceGroupName, storageSyncServiceName, syncGroupName, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName cannot be null or undefined and it must be of type string.'); + } + if (syncGroupName === null || syncGroupName === undefined || typeof syncGroupName.valueOf() !== 'string') { + throw new Error('syncGroupName 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.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + requestUrl = requestUrl.replace('{syncGroupName}', encodeURIComponent(syncGroupName)); + 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['ErrorModel']().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['CloudEndpointArray']().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 CloudEndpointsGet. */ +class CloudEndpointsGet { + /** + * Create a CloudEndpointsGet. + * @param {MicrosoftStorageSync} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listBySyncGroup = _listBySyncGroup; + } + + /** + * Get a CloudEndpoint List. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listBySyncGroupWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listBySyncGroup(resourceGroupName, storageSyncServiceName, syncGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get a CloudEndpoint List. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {CloudEndpointArray} - 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 CloudEndpointArray} 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. + */ + listBySyncGroup(resourceGroupName, storageSyncServiceName, syncGroupName, 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._listBySyncGroup(resourceGroupName, storageSyncServiceName, syncGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listBySyncGroup(resourceGroupName, storageSyncServiceName, syncGroupName, options, optionalCallback); + } + } + +} + +module.exports = CloudEndpointsGet; diff --git a/lib/services/storagesyncManagement/lib/operations/getSyncGroups.js b/lib/services/storagesyncManagement/lib/operations/getSyncGroups.js new file mode 100644 index 0000000000..d51b1421ff --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/getSyncGroups.js @@ -0,0 +1,282 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Get a SyncGroup List. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link SyncGroupArray} 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 _listByStorageSyncService(resourceGroupName, storageSyncServiceName, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName 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.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + 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['ErrorModel']().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['SyncGroupArray']().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 GetSyncGroups. */ +class GetSyncGroups { + /** + * Create a GetSyncGroups. + * @param {MicrosoftStorageSync} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listByStorageSyncService = _listByStorageSyncService; + } + + /** + * Get a SyncGroup List. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByStorageSyncServiceWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByStorageSyncService(resourceGroupName, storageSyncServiceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get a SyncGroup List. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {SyncGroupArray} - 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 SyncGroupArray} 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. + */ + listByStorageSyncService(resourceGroupName, storageSyncServiceName, 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._listByStorageSyncService(resourceGroupName, storageSyncServiceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByStorageSyncService(resourceGroupName, storageSyncServiceName, options, optionalCallback); + } + } + +} + +module.exports = GetSyncGroups; diff --git a/lib/services/storagesyncManagement/lib/operations/index.d.ts b/lib/services/storagesyncManagement/lib/operations/index.d.ts new file mode 100644 index 0000000000..5014843048 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/index.d.ts @@ -0,0 +1,4022 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. +*/ + +import { ServiceClientOptions, RequestOptions, ServiceCallback, HttpOperationResponse } from 'ms-rest'; +import * as models from '../models'; + + +/** + * @class + * OperationGet + * __NOTE__: An instance of this class is automatically created for an + * instance of the MicrosoftStorageSync. + */ +export interface OperationGet { + + + /** + * Lists all of the available Storage Sync Rest API operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all of the available Storage Sync Rest API operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {OperationEntityListResult} - 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. + * + * {OperationEntityListResult} [result] - The deserialized result object if an error did not occur. + * See {@link OperationEntityListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all of the available Storage Sync Rest API operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all of the available Storage Sync Rest API operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {OperationEntityListResult} - 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. + * + * {OperationEntityListResult} [result] - The deserialized result object if an error did not occur. + * See {@link OperationEntityListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * StorageSyncServices + * __NOTE__: An instance of this class is automatically created for an + * instance of the MicrosoftStorageSync. + */ +export interface StorageSyncServices { + + + /** + * Create a new StorageSyncService. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {object} body Storage Sync Service resource name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + createWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, body: models.StorageSyncService, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create a new StorageSyncService. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {object} body Storage Sync Service resource name. + * + * @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 {StorageSyncService} - 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. + * + * {StorageSyncService} [result] - The deserialized result object if an error did not occur. + * See {@link StorageSyncService} 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. + */ + create(resourceGroupName: string, storageSyncServiceName: string, body: models.StorageSyncService, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, storageSyncServiceName: string, body: models.StorageSyncService, callback: ServiceCallback): void; + create(resourceGroupName: string, storageSyncServiceName: string, body: models.StorageSyncService, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get a given StorageSyncService. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get a given StorageSyncService. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {StorageSyncService} - 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. + * + * {StorageSyncService} [result] - The deserialized result object if an error did not occur. + * See {@link StorageSyncService} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, storageSyncServiceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, storageSyncServiceName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, storageSyncServiceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Patch a given StorageSyncService. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.body] Storage Sync Service resource. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, options?: { body? : models.StorageSyncService, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Patch a given StorageSyncService. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.body] Storage Sync Service resource. + * + * @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 {StorageSyncService} - 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. + * + * {StorageSyncService} [result] - The deserialized result object if an error did not occur. + * See {@link StorageSyncService} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, storageSyncServiceName: string, options?: { body? : models.StorageSyncService, customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, storageSyncServiceName: string, callback: ServiceCallback): void; + update(resourceGroupName: string, storageSyncServiceName: string, options: { body? : models.StorageSyncService, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete a given StorageSyncService. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete a given StorageSyncService. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, storageSyncServiceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, storageSyncServiceName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, storageSyncServiceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * StorageSyncServiceByResourceGroupGet + * __NOTE__: An instance of this class is automatically created for an + * instance of the MicrosoftStorageSync. + */ +export interface StorageSyncServiceByResourceGroupGet { + + + /** + * Get a StorageSyncService list by Resource group name. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get a StorageSyncService list by Resource group name. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @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 {StorageSyncServiceArray} - 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. + * + * {StorageSyncServiceArray} [result] - The deserialized result object if an error did not occur. + * See {@link StorageSyncServiceArray} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * StorageSyncServiceGet + * __NOTE__: An instance of this class is automatically created for an + * instance of the MicrosoftStorageSync. + */ +export interface StorageSyncServiceGet { + + + /** + * Get a StorageSyncService list by subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listBySubscriptionWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get a StorageSyncService list by subscription. + * + * @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 {StorageSyncServiceArray} - 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. + * + * {StorageSyncServiceArray} [result] - The deserialized result object if an error did not occur. + * See {@link StorageSyncServiceArray} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listBySubscription(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBySubscription(callback: ServiceCallback): void; + listBySubscription(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * GetSyncGroups + * __NOTE__: An instance of this class is automatically created for an + * instance of the MicrosoftStorageSync. + */ +export interface GetSyncGroups { + + + /** + * Get a SyncGroup List. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByStorageSyncServiceWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get a SyncGroup List. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {SyncGroupArray} - 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. + * + * {SyncGroupArray} [result] - The deserialized result object if an error did not occur. + * See {@link SyncGroupArray} 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. + */ + listByStorageSyncService(resourceGroupName: string, storageSyncServiceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByStorageSyncService(resourceGroupName: string, storageSyncServiceName: string, callback: ServiceCallback): void; + listByStorageSyncService(resourceGroupName: string, storageSyncServiceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * SyncGroups + * __NOTE__: An instance of this class is automatically created for an + * instance of the MicrosoftStorageSync. + */ +export interface SyncGroups { + + + /** + * Create a new SyncGroup. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {object} body Sync Group Body + * + * @param {string} [body.uniqueId] Unique Id + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + createWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, body: models.SyncGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create a new SyncGroup. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {object} body Sync Group Body + * + * @param {string} [body.uniqueId] Unique Id + * + * @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 {SyncGroup} - 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. + * + * {SyncGroup} [result] - The deserialized result object if an error did not occur. + * See {@link SyncGroup} 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. + */ + create(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, body: models.SyncGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, body: models.SyncGroup, callback: ServiceCallback): void; + create(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, body: models.SyncGroup, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get a given SyncGroup. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get a given SyncGroup. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {SyncGroup} - 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. + * + * {SyncGroup} [result] - The deserialized result object if an error did not occur. + * See {@link SyncGroup} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete a given SyncGroup. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete a given SyncGroup. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * CloudEndpoints + * __NOTE__: An instance of this class is automatically created for an + * instance of the MicrosoftStorageSync. + */ +export interface CloudEndpoints { + + + /** + * Create a new CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint resource. + * + * @param {string} [body.storageAccountKey] Storage Account access key. + * + * @param {string} [body.storageAccount] Storage Account name. + * + * @param {string} [body.storageAccountResourceId] Storage Account Resource Id + * + * @param {string} [body.storageAccountShareName] Storage Account Share name + * + * @param {string} [body.storageAccountTenantId] Storage Account Tenant Id + * + * @param {string} [body.partnershipId] Partnership Id + * + * @param {string} [body.friendlyName] Friendly Name + * + * @param {boolean} [body.backupEnabled] Backup Enabled + * + * @param {string} [body.provisioningState] CloudEndpoint Provisioning State + * + * @param {string} [body.lastWorkflowId] CloudEndpoint lastWorkflowId + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + createWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.CloudEndpoint, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create a new CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint resource. + * + * @param {string} [body.storageAccountKey] Storage Account access key. + * + * @param {string} [body.storageAccount] Storage Account name. + * + * @param {string} [body.storageAccountResourceId] Storage Account Resource Id + * + * @param {string} [body.storageAccountShareName] Storage Account Share name + * + * @param {string} [body.storageAccountTenantId] Storage Account Tenant Id + * + * @param {string} [body.partnershipId] Partnership Id + * + * @param {string} [body.friendlyName] Friendly Name + * + * @param {boolean} [body.backupEnabled] Backup Enabled + * + * @param {string} [body.provisioningState] CloudEndpoint Provisioning State + * + * @param {string} [body.lastWorkflowId] CloudEndpoint lastWorkflowId + * + * @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 {CloudEndpoint} - 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. + * + * {CloudEndpoint} [result] - The deserialized result object if an error did not occur. + * See {@link CloudEndpoint} 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. + */ + create(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.CloudEndpoint, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.CloudEndpoint, callback: ServiceCallback): void; + create(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.CloudEndpoint, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @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 {CloudEndpoint} - 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. + * + * {CloudEndpoint} [result] - The deserialized result object if an error did not occur. + * See {@link CloudEndpoint} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create a new CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint resource. + * + * @param {string} [body.storageAccountKey] Storage Account access key. + * + * @param {string} [body.storageAccount] Storage Account name. + * + * @param {string} [body.storageAccountResourceId] Storage Account Resource Id + * + * @param {string} [body.storageAccountShareName] Storage Account Share name + * + * @param {string} [body.storageAccountTenantId] Storage Account Tenant Id + * + * @param {string} [body.partnershipId] Partnership Id + * + * @param {string} [body.friendlyName] Friendly Name + * + * @param {boolean} [body.backupEnabled] Backup Enabled + * + * @param {string} [body.provisioningState] CloudEndpoint Provisioning State + * + * @param {string} [body.lastWorkflowId] CloudEndpoint lastWorkflowId + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.CloudEndpoint, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create a new CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint resource. + * + * @param {string} [body.storageAccountKey] Storage Account access key. + * + * @param {string} [body.storageAccount] Storage Account name. + * + * @param {string} [body.storageAccountResourceId] Storage Account Resource Id + * + * @param {string} [body.storageAccountShareName] Storage Account Share name + * + * @param {string} [body.storageAccountTenantId] Storage Account Tenant Id + * + * @param {string} [body.partnershipId] Partnership Id + * + * @param {string} [body.friendlyName] Friendly Name + * + * @param {boolean} [body.backupEnabled] Backup Enabled + * + * @param {string} [body.provisioningState] CloudEndpoint Provisioning State + * + * @param {string} [body.lastWorkflowId] CloudEndpoint lastWorkflowId + * + * @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 {CloudEndpoint} - 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. + * + * {CloudEndpoint} [result] - The deserialized result object if an error did not occur. + * See {@link CloudEndpoint} 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, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.CloudEndpoint, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreate(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.CloudEndpoint, callback: ServiceCallback): void; + beginCreate(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.CloudEndpoint, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @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, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * CloudEndpointsGet + * __NOTE__: An instance of this class is automatically created for an + * instance of the MicrosoftStorageSync. + */ +export interface CloudEndpointsGet { + + + /** + * Get a CloudEndpoint List. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listBySyncGroupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get a CloudEndpoint List. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {CloudEndpointArray} - 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. + * + * {CloudEndpointArray} [result] - The deserialized result object if an error did not occur. + * See {@link CloudEndpointArray} 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. + */ + listBySyncGroup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBySyncGroup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, callback: ServiceCallback): void; + listBySyncGroup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * CloudEndpointPreBackup + * __NOTE__: An instance of this class is automatically created for an + * instance of the MicrosoftStorageSync. + */ +export interface CloudEndpointPreBackup { + + + /** + * Pre Backup a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + postWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Pre Backup a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * + * @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. + */ + post(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + post(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, callback: ServiceCallback): void; + post(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Pre Backup a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + beginPostWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Pre Backup a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * + * @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. + */ + beginPost(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginPost(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, callback: ServiceCallback): void; + beginPost(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * CloudEndpointPostBackup + * __NOTE__: An instance of this class is automatically created for an + * instance of the MicrosoftStorageSync. + */ +export interface CloudEndpointPostBackup { + + + /** + * Post Backup a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + postWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Post Backup a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * + * @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 {PostBackupResponse} - 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. + * + * {PostBackupResponse} [result] - The deserialized result object if an error did not occur. + * See {@link PostBackupResponse} 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. + */ + post(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + post(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, callback: ServiceCallback): void; + post(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Post Backup a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + beginPostWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Post Backup a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * + * @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 {PostBackupResponse} - 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. + * + * {PostBackupResponse} [result] - The deserialized result object if an error did not occur. + * See {@link PostBackupResponse} 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. + */ + beginPost(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginPost(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, callback: ServiceCallback): void; + beginPost(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * CloudEndpointPreRestore + * __NOTE__: An instance of this class is automatically created for an + * instance of the MicrosoftStorageSync. + */ +export interface CloudEndpointPreRestore { + + + /** + * Pre Restore a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint object. + * + * @param {string} [body.partition] Pre Restore partition. + * + * @param {string} [body.replicaGroup] Pre Restore replica group. + * + * @param {string} [body.requestId] Pre Restore request id. + * + * @param {string} [body.azureFileShareUri] Pre Restore Azure file share uri. + * + * @param {string} [body.status] Pre Restore Azure status. + * + * @param {string} [body.sourceAzureFileShareUri] Pre Restore Azure source + * azure file share uri. + * + * @param {string} [body.backupMetadataPropertyBag] Pre Restore backup metadata + * property bag. + * + * @param {array} [body.restoreFileSpec] Pre Restore restore file spec array. + * + * @param {number} [body.pausewaitforsyncdraintimeperiodinseconds] Pre Restore + * pause wait for sync drain time period in seconds. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + postWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PreRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Pre Restore a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint object. + * + * @param {string} [body.partition] Pre Restore partition. + * + * @param {string} [body.replicaGroup] Pre Restore replica group. + * + * @param {string} [body.requestId] Pre Restore request id. + * + * @param {string} [body.azureFileShareUri] Pre Restore Azure file share uri. + * + * @param {string} [body.status] Pre Restore Azure status. + * + * @param {string} [body.sourceAzureFileShareUri] Pre Restore Azure source + * azure file share uri. + * + * @param {string} [body.backupMetadataPropertyBag] Pre Restore backup metadata + * property bag. + * + * @param {array} [body.restoreFileSpec] Pre Restore restore file spec array. + * + * @param {number} [body.pausewaitforsyncdraintimeperiodinseconds] Pre Restore + * pause wait for sync drain time period in seconds. + * + * @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. + */ + post(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PreRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + post(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PreRestoreRequest, callback: ServiceCallback): void; + post(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PreRestoreRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Pre Restore a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint object. + * + * @param {string} [body.partition] Pre Restore partition. + * + * @param {string} [body.replicaGroup] Pre Restore replica group. + * + * @param {string} [body.requestId] Pre Restore request id. + * + * @param {string} [body.azureFileShareUri] Pre Restore Azure file share uri. + * + * @param {string} [body.status] Pre Restore Azure status. + * + * @param {string} [body.sourceAzureFileShareUri] Pre Restore Azure source + * azure file share uri. + * + * @param {string} [body.backupMetadataPropertyBag] Pre Restore backup metadata + * property bag. + * + * @param {array} [body.restoreFileSpec] Pre Restore restore file spec array. + * + * @param {number} [body.pausewaitforsyncdraintimeperiodinseconds] Pre Restore + * pause wait for sync drain time period in seconds. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + beginPostWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PreRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Pre Restore a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint object. + * + * @param {string} [body.partition] Pre Restore partition. + * + * @param {string} [body.replicaGroup] Pre Restore replica group. + * + * @param {string} [body.requestId] Pre Restore request id. + * + * @param {string} [body.azureFileShareUri] Pre Restore Azure file share uri. + * + * @param {string} [body.status] Pre Restore Azure status. + * + * @param {string} [body.sourceAzureFileShareUri] Pre Restore Azure source + * azure file share uri. + * + * @param {string} [body.backupMetadataPropertyBag] Pre Restore backup metadata + * property bag. + * + * @param {array} [body.restoreFileSpec] Pre Restore restore file spec array. + * + * @param {number} [body.pausewaitforsyncdraintimeperiodinseconds] Pre Restore + * pause wait for sync drain time period in seconds. + * + * @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. + */ + beginPost(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PreRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginPost(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PreRestoreRequest, callback: ServiceCallback): void; + beginPost(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PreRestoreRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * CloudEndpointRestoreHeatbeat + * __NOTE__: An instance of this class is automatically created for an + * instance of the MicrosoftStorageSync. + */ +export interface CloudEndpointRestoreHeatbeat { + + + /** + * Restore Heartbeat a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + postWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Restore Heartbeat a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @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. + */ + post(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + post(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, callback: ServiceCallback): void; + post(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * CloudEndpointPostRestore + * __NOTE__: An instance of this class is automatically created for an + * instance of the MicrosoftStorageSync. + */ +export interface CloudEndpointPostRestore { + + + /** + * Post Restore a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint object. + * + * @param {string} [body.partition] Post Restore partition. + * + * @param {string} [body.replicaGroup] Post Restore replica group. + * + * @param {string} [body.requestId] Post Restore request id. + * + * @param {string} [body.azureFileShareUri] Post Restore Azure file share uri. + * + * @param {string} [body.status] Post Restore Azure status. + * + * @param {string} [body.sourceAzureFileShareUri] Post Restore Azure source + * azure file share uri. + * + * @param {string} [body.failedFileList] Post Restore Azure failed file list. + * + * @param {array} [body.restoreFileSpec] Post Restore restore file spec array. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + postWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PostRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Post Restore a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint object. + * + * @param {string} [body.partition] Post Restore partition. + * + * @param {string} [body.replicaGroup] Post Restore replica group. + * + * @param {string} [body.requestId] Post Restore request id. + * + * @param {string} [body.azureFileShareUri] Post Restore Azure file share uri. + * + * @param {string} [body.status] Post Restore Azure status. + * + * @param {string} [body.sourceAzureFileShareUri] Post Restore Azure source + * azure file share uri. + * + * @param {string} [body.failedFileList] Post Restore Azure failed file list. + * + * @param {array} [body.restoreFileSpec] Post Restore restore file spec array. + * + * @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. + */ + post(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PostRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + post(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PostRestoreRequest, callback: ServiceCallback): void; + post(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PostRestoreRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Post Restore a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint object. + * + * @param {string} [body.partition] Post Restore partition. + * + * @param {string} [body.replicaGroup] Post Restore replica group. + * + * @param {string} [body.requestId] Post Restore request id. + * + * @param {string} [body.azureFileShareUri] Post Restore Azure file share uri. + * + * @param {string} [body.status] Post Restore Azure status. + * + * @param {string} [body.sourceAzureFileShareUri] Post Restore Azure source + * azure file share uri. + * + * @param {string} [body.failedFileList] Post Restore Azure failed file list. + * + * @param {array} [body.restoreFileSpec] Post Restore restore file spec array. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + beginPostWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PostRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Post Restore a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint object. + * + * @param {string} [body.partition] Post Restore partition. + * + * @param {string} [body.replicaGroup] Post Restore replica group. + * + * @param {string} [body.requestId] Post Restore request id. + * + * @param {string} [body.azureFileShareUri] Post Restore Azure file share uri. + * + * @param {string} [body.status] Post Restore Azure status. + * + * @param {string} [body.sourceAzureFileShareUri] Post Restore Azure source + * azure file share uri. + * + * @param {string} [body.failedFileList] Post Restore Azure failed file list. + * + * @param {array} [body.restoreFileSpec] Post Restore restore file spec array. + * + * @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. + */ + beginPost(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PostRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginPost(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PostRestoreRequest, callback: ServiceCallback): void; + beginPost(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PostRestoreRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ServerEndpoints + * __NOTE__: An instance of this class is automatically created for an + * instance of the MicrosoftStorageSync. + */ +export interface ServerEndpoints { + + + /** + * Create a new ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @param {object} body Body of Server Endpoint object. + * + * @param {string} [body.serverLocalPath] Server Local path. + * + * @param {string} [body.cloudTiering] Cloud Tiering. Possible values include: + * 'on', 'off' + * + * @param {number} [body.volumeFreeSpacePercent] Level of free space to be + * maintained by Cloud Tiering if it is enabled. + * + * @param {string} [body.friendlyName] Friendly Name + * + * @param {date} [body.lastSyncSuccess] Last Sync Success + * + * @param {string} [body.syncErrorState] Sync Error State + * + * @param {date} [body.syncErrorStateTimestamp] Sync Error State Timestamp + * + * @param {string} [body.syncErrorDirection] Sync Error Direction. Possible + * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * + * @param {number} [body.itemUploadErrorCount] Item Upload Error Count. + * + * @param {number} [body.itemDownloadErrorCount] Item download error count. + * + * @param {string} [body.syncErrorContext] sync error context. + * + * @param {string} [body.currentProgressType] current progress type. Possible + * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * + * @param {number} [body.itemProgressCount] Item Progress Count + * + * @param {number} [body.itemTotalCount] Item Total Count + * + * @param {number} [body.byteProgress] Bytes in progress + * + * @param {number} [body.totalProgress] Total progress + * + * @param {number} [body.byteTotal] Bytes total + * + * @param {string} [body.serverResourceId] Server Resource Id. + * + * @param {string} [body.provisioningState] ServerEndpoint Provisioning State + * + * @param {string} [body.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + createWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, body: models.ServerEndpoint, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create a new ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @param {object} body Body of Server Endpoint object. + * + * @param {string} [body.serverLocalPath] Server Local path. + * + * @param {string} [body.cloudTiering] Cloud Tiering. Possible values include: + * 'on', 'off' + * + * @param {number} [body.volumeFreeSpacePercent] Level of free space to be + * maintained by Cloud Tiering if it is enabled. + * + * @param {string} [body.friendlyName] Friendly Name + * + * @param {date} [body.lastSyncSuccess] Last Sync Success + * + * @param {string} [body.syncErrorState] Sync Error State + * + * @param {date} [body.syncErrorStateTimestamp] Sync Error State Timestamp + * + * @param {string} [body.syncErrorDirection] Sync Error Direction. Possible + * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * + * @param {number} [body.itemUploadErrorCount] Item Upload Error Count. + * + * @param {number} [body.itemDownloadErrorCount] Item download error count. + * + * @param {string} [body.syncErrorContext] sync error context. + * + * @param {string} [body.currentProgressType] current progress type. Possible + * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * + * @param {number} [body.itemProgressCount] Item Progress Count + * + * @param {number} [body.itemTotalCount] Item Total Count + * + * @param {number} [body.byteProgress] Bytes in progress + * + * @param {number} [body.totalProgress] Total progress + * + * @param {number} [body.byteTotal] Bytes total + * + * @param {string} [body.serverResourceId] Server Resource Id. + * + * @param {string} [body.provisioningState] ServerEndpoint Provisioning State + * + * @param {string} [body.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @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 {ServerEndpoint} - 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. + * + * {ServerEndpoint} [result] - The deserialized result object if an error did not occur. + * See {@link ServerEndpoint} 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. + */ + create(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, body: models.ServerEndpoint, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, body: models.ServerEndpoint, callback: ServiceCallback): void; + create(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, body: models.ServerEndpoint, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Patch a given ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.body] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.body.serverLocalPath] Server Local path. + * + * @param {string} [options.body.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [options.body.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.body.friendlyName] Friendly Name + * + * @param {date} [options.body.lastSyncSuccess] Last Sync Success + * + * @param {string} [options.body.syncErrorState] Sync Error State + * + * @param {date} [options.body.syncErrorStateTimestamp] Sync Error State + * Timestamp + * + * @param {string} [options.body.syncErrorDirection] Sync Error Direction. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [options.body.itemUploadErrorCount] Item Upload Error Count. + * + * @param {number} [options.body.itemDownloadErrorCount] Item download error + * count. + * + * @param {string} [options.body.syncErrorContext] sync error context. + * + * @param {string} [options.body.currentProgressType] current progress type. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [options.body.itemProgressCount] Item Progress Count + * + * @param {number} [options.body.itemTotalCount] Item Total Count + * + * @param {number} [options.body.byteProgress] Bytes in progress + * + * @param {number} [options.body.totalProgress] Total progress + * + * @param {number} [options.body.byteTotal] Bytes total + * + * @param {string} [options.body.serverResourceId] Server Resource Id. + * + * @param {string} [options.body.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [options.body.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { body? : models.ServerEndpoint, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Patch a given ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.body] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.body.serverLocalPath] Server Local path. + * + * @param {string} [options.body.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [options.body.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.body.friendlyName] Friendly Name + * + * @param {date} [options.body.lastSyncSuccess] Last Sync Success + * + * @param {string} [options.body.syncErrorState] Sync Error State + * + * @param {date} [options.body.syncErrorStateTimestamp] Sync Error State + * Timestamp + * + * @param {string} [options.body.syncErrorDirection] Sync Error Direction. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [options.body.itemUploadErrorCount] Item Upload Error Count. + * + * @param {number} [options.body.itemDownloadErrorCount] Item download error + * count. + * + * @param {string} [options.body.syncErrorContext] sync error context. + * + * @param {string} [options.body.currentProgressType] current progress type. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [options.body.itemProgressCount] Item Progress Count + * + * @param {number} [options.body.itemTotalCount] Item Total Count + * + * @param {number} [options.body.byteProgress] Bytes in progress + * + * @param {number} [options.body.totalProgress] Total progress + * + * @param {number} [options.body.byteTotal] Bytes total + * + * @param {string} [options.body.serverResourceId] Server Resource Id. + * + * @param {string} [options.body.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [options.body.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @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 {ServerEndpoint} - 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. + * + * {ServerEndpoint} [result] - The deserialized result object if an error did not occur. + * See {@link ServerEndpoint} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { body? : models.ServerEndpoint, customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, callback: ServiceCallback): void; + update(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options: { body? : models.ServerEndpoint, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get a ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get a ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @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 {ServerEndpoint} - 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. + * + * {ServerEndpoint} [result] - The deserialized result object if an error did not occur. + * See {@link ServerEndpoint} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete a given ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete a given ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create a new ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @param {object} body Body of Server Endpoint object. + * + * @param {string} [body.serverLocalPath] Server Local path. + * + * @param {string} [body.cloudTiering] Cloud Tiering. Possible values include: + * 'on', 'off' + * + * @param {number} [body.volumeFreeSpacePercent] Level of free space to be + * maintained by Cloud Tiering if it is enabled. + * + * @param {string} [body.friendlyName] Friendly Name + * + * @param {date} [body.lastSyncSuccess] Last Sync Success + * + * @param {string} [body.syncErrorState] Sync Error State + * + * @param {date} [body.syncErrorStateTimestamp] Sync Error State Timestamp + * + * @param {string} [body.syncErrorDirection] Sync Error Direction. Possible + * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * + * @param {number} [body.itemUploadErrorCount] Item Upload Error Count. + * + * @param {number} [body.itemDownloadErrorCount] Item download error count. + * + * @param {string} [body.syncErrorContext] sync error context. + * + * @param {string} [body.currentProgressType] current progress type. Possible + * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * + * @param {number} [body.itemProgressCount] Item Progress Count + * + * @param {number} [body.itemTotalCount] Item Total Count + * + * @param {number} [body.byteProgress] Bytes in progress + * + * @param {number} [body.totalProgress] Total progress + * + * @param {number} [body.byteTotal] Bytes total + * + * @param {string} [body.serverResourceId] Server Resource Id. + * + * @param {string} [body.provisioningState] ServerEndpoint Provisioning State + * + * @param {string} [body.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, body: models.ServerEndpoint, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create a new ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @param {object} body Body of Server Endpoint object. + * + * @param {string} [body.serverLocalPath] Server Local path. + * + * @param {string} [body.cloudTiering] Cloud Tiering. Possible values include: + * 'on', 'off' + * + * @param {number} [body.volumeFreeSpacePercent] Level of free space to be + * maintained by Cloud Tiering if it is enabled. + * + * @param {string} [body.friendlyName] Friendly Name + * + * @param {date} [body.lastSyncSuccess] Last Sync Success + * + * @param {string} [body.syncErrorState] Sync Error State + * + * @param {date} [body.syncErrorStateTimestamp] Sync Error State Timestamp + * + * @param {string} [body.syncErrorDirection] Sync Error Direction. Possible + * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * + * @param {number} [body.itemUploadErrorCount] Item Upload Error Count. + * + * @param {number} [body.itemDownloadErrorCount] Item download error count. + * + * @param {string} [body.syncErrorContext] sync error context. + * + * @param {string} [body.currentProgressType] current progress type. Possible + * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * + * @param {number} [body.itemProgressCount] Item Progress Count + * + * @param {number} [body.itemTotalCount] Item Total Count + * + * @param {number} [body.byteProgress] Bytes in progress + * + * @param {number} [body.totalProgress] Total progress + * + * @param {number} [body.byteTotal] Bytes total + * + * @param {string} [body.serverResourceId] Server Resource Id. + * + * @param {string} [body.provisioningState] ServerEndpoint Provisioning State + * + * @param {string} [body.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @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 {ServerEndpoint} - 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. + * + * {ServerEndpoint} [result] - The deserialized result object if an error did not occur. + * See {@link ServerEndpoint} 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, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, body: models.ServerEndpoint, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreate(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, body: models.ServerEndpoint, callback: ServiceCallback): void; + beginCreate(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, body: models.ServerEndpoint, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Patch a given ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.body] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.body.serverLocalPath] Server Local path. + * + * @param {string} [options.body.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [options.body.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.body.friendlyName] Friendly Name + * + * @param {date} [options.body.lastSyncSuccess] Last Sync Success + * + * @param {string} [options.body.syncErrorState] Sync Error State + * + * @param {date} [options.body.syncErrorStateTimestamp] Sync Error State + * Timestamp + * + * @param {string} [options.body.syncErrorDirection] Sync Error Direction. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [options.body.itemUploadErrorCount] Item Upload Error Count. + * + * @param {number} [options.body.itemDownloadErrorCount] Item download error + * count. + * + * @param {string} [options.body.syncErrorContext] sync error context. + * + * @param {string} [options.body.currentProgressType] current progress type. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [options.body.itemProgressCount] Item Progress Count + * + * @param {number} [options.body.itemTotalCount] Item Total Count + * + * @param {number} [options.body.byteProgress] Bytes in progress + * + * @param {number} [options.body.totalProgress] Total progress + * + * @param {number} [options.body.byteTotal] Bytes total + * + * @param {string} [options.body.serverResourceId] Server Resource Id. + * + * @param {string} [options.body.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [options.body.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @param {object} [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. + */ + beginUpdateWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { body? : models.ServerEndpoint, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Patch a given ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.body] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.body.serverLocalPath] Server Local path. + * + * @param {string} [options.body.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [options.body.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.body.friendlyName] Friendly Name + * + * @param {date} [options.body.lastSyncSuccess] Last Sync Success + * + * @param {string} [options.body.syncErrorState] Sync Error State + * + * @param {date} [options.body.syncErrorStateTimestamp] Sync Error State + * Timestamp + * + * @param {string} [options.body.syncErrorDirection] Sync Error Direction. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [options.body.itemUploadErrorCount] Item Upload Error Count. + * + * @param {number} [options.body.itemDownloadErrorCount] Item download error + * count. + * + * @param {string} [options.body.syncErrorContext] sync error context. + * + * @param {string} [options.body.currentProgressType] current progress type. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [options.body.itemProgressCount] Item Progress Count + * + * @param {number} [options.body.itemTotalCount] Item Total Count + * + * @param {number} [options.body.byteProgress] Bytes in progress + * + * @param {number} [options.body.totalProgress] Total progress + * + * @param {number} [options.body.byteTotal] Bytes total + * + * @param {string} [options.body.serverResourceId] Server Resource Id. + * + * @param {string} [options.body.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [options.body.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @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 {ServerEndpoint} - 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. + * + * {ServerEndpoint} [result] - The deserialized result object if an error did not occur. + * See {@link ServerEndpoint} 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. + */ + beginUpdate(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { body? : models.ServerEndpoint, customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdate(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, callback: ServiceCallback): void; + beginUpdate(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options: { body? : models.ServerEndpoint, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete a given ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete a given ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @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, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ServerEndpointsGet + * __NOTE__: An instance of this class is automatically created for an + * instance of the MicrosoftStorageSync. + */ +export interface ServerEndpointsGet { + + + /** + * Get a ServerEndpoint list. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listBySyncGroupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get a ServerEndpoint list. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ServerEndpointArray} - 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. + * + * {ServerEndpointArray} [result] - The deserialized result object if an error did not occur. + * See {@link ServerEndpointArray} 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. + */ + listBySyncGroup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBySyncGroup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, callback: ServiceCallback): void; + listBySyncGroup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ServerEndpointRecall + * __NOTE__: An instance of this class is automatically created for an + * instance of the MicrosoftStorageSync. + */ +export interface ServerEndpointRecall { + + + /** + * Recall a serverendpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + postWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Recall a serverendpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @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. + */ + post(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + post(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, callback: ServiceCallback): void; + post(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Recall a serverendpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + beginPostWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Recall a serverendpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @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. + */ + beginPost(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginPost(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, callback: ServiceCallback): void; + beginPost(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * RegisteredServersGet + * __NOTE__: An instance of this class is automatically created for an + * instance of the MicrosoftStorageSync. + */ +export interface RegisteredServersGet { + + + /** + * Get a given registered server list. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByStorageSyncServiceWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get a given registered server list. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {RegisteredServerArray} - 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. + * + * {RegisteredServerArray} [result] - The deserialized result object if an error did not occur. + * See {@link RegisteredServerArray} 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. + */ + listByStorageSyncService(resourceGroupName: string, storageSyncServiceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByStorageSyncService(resourceGroupName: string, storageSyncServiceName: string, callback: ServiceCallback): void; + listByStorageSyncService(resourceGroupName: string, storageSyncServiceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * RegisteredServers + * __NOTE__: An instance of this class is automatically created for an + * instance of the MicrosoftStorageSync. + */ +export interface RegisteredServers { + + + /** + * Get a given registered server. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} serverId GUID identifying the on-premises server. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, serverId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get a given registered server. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} serverId GUID identifying the on-premises server. + * + * @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 {RegisteredServer} - 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. + * + * {RegisteredServer} [result] - The deserialized result object if an error did not occur. + * See {@link RegisteredServer} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, storageSyncServiceName: string, serverId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, storageSyncServiceName: string, serverId: string, callback: ServiceCallback): void; + get(resourceGroupName: string, storageSyncServiceName: string, serverId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Add a new registered server. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} serverId GUID identifying the on-premises server. + * + * @param {object} body Body of Registered Server object. + * + * @param {string} [body.serverCertificate] Registered Server Certificate + * + * @param {string} [body.agentVersion] Registered Server Agent Version + * + * @param {string} [body.serverOSVersion] Registered Server OS Version + * + * @param {number} [body.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [body.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [body.provisioningState] Registered Server Provisioning + * State + * + * @param {string} [body.serverRole] Registered Server serverRole + * + * @param {string} [body.clusterId] Registered Server clusterId + * + * @param {string} [body.clusterName] Registered Server clusterName + * + * @param {string} [body.serverId] Registered Server serverId + * + * @param {string} [body.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [body.lastWorkflowId] Registered Server lastWorkflowId + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + createWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, serverId: string, body: models.RegisteredServer, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Add a new registered server. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} serverId GUID identifying the on-premises server. + * + * @param {object} body Body of Registered Server object. + * + * @param {string} [body.serverCertificate] Registered Server Certificate + * + * @param {string} [body.agentVersion] Registered Server Agent Version + * + * @param {string} [body.serverOSVersion] Registered Server OS Version + * + * @param {number} [body.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [body.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [body.provisioningState] Registered Server Provisioning + * State + * + * @param {string} [body.serverRole] Registered Server serverRole + * + * @param {string} [body.clusterId] Registered Server clusterId + * + * @param {string} [body.clusterName] Registered Server clusterName + * + * @param {string} [body.serverId] Registered Server serverId + * + * @param {string} [body.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [body.lastWorkflowId] Registered Server lastWorkflowId + * + * @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 {RegisteredServer} - 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. + * + * {RegisteredServer} [result] - The deserialized result object if an error did not occur. + * See {@link RegisteredServer} 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. + */ + create(resourceGroupName: string, storageSyncServiceName: string, serverId: string, body: models.RegisteredServer, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, storageSyncServiceName: string, serverId: string, body: models.RegisteredServer, callback: ServiceCallback): void; + create(resourceGroupName: string, storageSyncServiceName: string, serverId: string, body: models.RegisteredServer, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete the given registered server. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} serverId GUID identifying the on-premises server. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, serverId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete the given registered server. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} serverId GUID identifying the on-premises server. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, storageSyncServiceName: string, serverId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, storageSyncServiceName: string, serverId: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, storageSyncServiceName: string, serverId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Add a new registered server. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} serverId GUID identifying the on-premises server. + * + * @param {object} body Body of Registered Server object. + * + * @param {string} [body.serverCertificate] Registered Server Certificate + * + * @param {string} [body.agentVersion] Registered Server Agent Version + * + * @param {string} [body.serverOSVersion] Registered Server OS Version + * + * @param {number} [body.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [body.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [body.provisioningState] Registered Server Provisioning + * State + * + * @param {string} [body.serverRole] Registered Server serverRole + * + * @param {string} [body.clusterId] Registered Server clusterId + * + * @param {string} [body.clusterName] Registered Server clusterName + * + * @param {string} [body.serverId] Registered Server serverId + * + * @param {string} [body.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [body.lastWorkflowId] Registered Server lastWorkflowId + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, storageSyncServiceName: string, serverId: string, body: models.RegisteredServer, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Add a new registered server. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} serverId GUID identifying the on-premises server. + * + * @param {object} body Body of Registered Server object. + * + * @param {string} [body.serverCertificate] Registered Server Certificate + * + * @param {string} [body.agentVersion] Registered Server Agent Version + * + * @param {string} [body.serverOSVersion] Registered Server OS Version + * + * @param {number} [body.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [body.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [body.provisioningState] Registered Server Provisioning + * State + * + * @param {string} [body.serverRole] Registered Server serverRole + * + * @param {string} [body.clusterId] Registered Server clusterId + * + * @param {string} [body.clusterName] Registered Server clusterName + * + * @param {string} [body.serverId] Registered Server serverId + * + * @param {string} [body.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [body.lastWorkflowId] Registered Server lastWorkflowId + * + * @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 {RegisteredServer} - 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. + * + * {RegisteredServer} [result] - The deserialized result object if an error did not occur. + * See {@link RegisteredServer} 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, storageSyncServiceName: string, serverId: string, body: models.RegisteredServer, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreate(resourceGroupName: string, storageSyncServiceName: string, serverId: string, body: models.RegisteredServer, callback: ServiceCallback): void; + beginCreate(resourceGroupName: string, storageSyncServiceName: string, serverId: string, body: models.RegisteredServer, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete the given registered server. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} serverId GUID identifying the on-premises server. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, storageSyncServiceName: string, serverId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete the given registered server. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} serverId GUID identifying the on-premises server. + * + * @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, storageSyncServiceName: string, serverId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, storageSyncServiceName: string, serverId: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, storageSyncServiceName: string, serverId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Workflows + * __NOTE__: An instance of this class is automatically created for an + * instance of the MicrosoftStorageSync. + */ +export interface Workflows { + + + /** + * Get Workflows resource + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} workflowId workflow Id + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, workflowId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get Workflows resource + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} workflowId workflow Id + * + * @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 {Workflow} - 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. + * + * {Workflow} [result] - The deserialized result object if an error did not occur. + * See {@link Workflow} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, storageSyncServiceName: string, workflowId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, storageSyncServiceName: string, workflowId: string, callback: ServiceCallback): void; + get(resourceGroupName: string, storageSyncServiceName: string, workflowId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * AbortWorkflows + * __NOTE__: An instance of this class is automatically created for an + * instance of the MicrosoftStorageSync. + */ +export interface AbortWorkflows { + + + /** + * Abort the given workflow. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} workflowId workflow Id + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + postWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, workflowId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Abort the given workflow. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} workflowId workflow Id + * + * @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. + */ + post(resourceGroupName: string, storageSyncServiceName: string, workflowId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + post(resourceGroupName: string, storageSyncServiceName: string, workflowId: string, callback: ServiceCallback): void; + post(resourceGroupName: string, storageSyncServiceName: string, workflowId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} diff --git a/lib/services/storagesyncManagement/lib/operations/index.js b/lib/services/storagesyncManagement/lib/operations/index.js new file mode 100644 index 0000000000..8914e451fc --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/index.js @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +exports.OperationGet = require('./operationGet'); +exports.StorageSyncServices = require('./storageSyncServices'); +exports.StorageSyncServiceByResourceGroupGet = require('./storageSyncServiceByResourceGroupGet'); +exports.StorageSyncServiceGet = require('./storageSyncServiceGet'); +exports.GetSyncGroups = require('./getSyncGroups'); +exports.SyncGroups = require('./syncGroups'); +exports.CloudEndpoints = require('./cloudEndpoints'); +exports.CloudEndpointsGet = require('./cloudEndpointsGet'); +exports.CloudEndpointPreBackup = require('./cloudEndpointPreBackup'); +exports.CloudEndpointPostBackup = require('./cloudEndpointPostBackup'); +exports.CloudEndpointPreRestore = require('./cloudEndpointPreRestore'); +exports.CloudEndpointRestoreHeatbeat = require('./cloudEndpointRestoreHeatbeat'); +exports.CloudEndpointPostRestore = require('./cloudEndpointPostRestore'); +exports.ServerEndpoints = require('./serverEndpoints'); +exports.ServerEndpointsGet = require('./serverEndpointsGet'); +exports.ServerEndpointRecall = require('./serverEndpointRecall'); +exports.RegisteredServersGet = require('./registeredServersGet'); +exports.RegisteredServers = require('./registeredServers'); +exports.Workflows = require('./workflows'); +exports.AbortWorkflows = require('./abortWorkflows'); diff --git a/lib/services/storagesyncManagement/lib/operations/operationGet.js b/lib/services/storagesyncManagement/lib/operations/operationGet.js new file mode 100644 index 0000000000..d3040bf98f --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/operationGet.js @@ -0,0 +1,455 @@ +/* + * 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 all of the available Storage Sync Rest API operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationEntityListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.StorageSync/operations'; + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['ErrorModel']().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['OperationEntityListResult']().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); + }); +} + +/** + * Lists all of the available Storage Sync Rest API operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationEntityListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['ErrorModel']().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['OperationEntityListResult']().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 OperationGet. */ +class OperationGet { + /** + * Create a OperationGet. + * @param {MicrosoftStorageSync} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._listNext = _listNext; + } + + /** + * Lists all of the available Storage Sync Rest API operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all of the available Storage Sync Rest API operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {OperationEntityListResult} - 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 OperationEntityListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + + /** + * Lists all of the available Storage Sync Rest API operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all of the available Storage Sync Rest API operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {OperationEntityListResult} - 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 OperationEntityListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = OperationGet; diff --git a/lib/services/storagesyncManagement/lib/operations/registeredServers.js b/lib/services/storagesyncManagement/lib/operations/registeredServers.js new file mode 100644 index 0000000000..90c804b5aa --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/registeredServers.js @@ -0,0 +1,1328 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Get a given registered server. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} serverId GUID identifying the on-premises server. + * + * @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 RegisteredServer} 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, storageSyncServiceName, serverId, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName cannot be null or undefined and it must be of type string.'); + } + if (serverId === null || serverId === undefined || typeof serverId.valueOf() !== 'string') { + throw new Error('serverId 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.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + requestUrl = requestUrl.replace('{serverId}', encodeURIComponent(serverId)); + 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['ErrorModel']().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['RegisteredServer']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Add a new registered server. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} serverId GUID identifying the on-premises server. + * + * @param {object} body Body of Registered Server object. + * + * @param {string} [body.serverCertificate] Registered Server Certificate + * + * @param {string} [body.agentVersion] Registered Server Agent Version + * + * @param {string} [body.serverOSVersion] Registered Server OS Version + * + * @param {number} [body.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [body.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [body.provisioningState] Registered Server Provisioning + * State + * + * @param {string} [body.serverRole] Registered Server serverRole + * + * @param {string} [body.clusterId] Registered Server clusterId + * + * @param {string} [body.clusterName] Registered Server clusterName + * + * @param {string} [body.serverId] Registered Server serverId + * + * @param {string} [body.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [body.lastWorkflowId] Registered Server lastWorkflowId + * + * @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 RegisteredServer} 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 _create(resourceGroupName, storageSyncServiceName, serverId, body, 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, storageSyncServiceName, serverId, body, 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['RegisteredServer']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Delete the given registered server. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} serverId GUID identifying the on-premises server. + * + * @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, storageSyncServiceName, serverId, 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, storageSyncServiceName, serverId, 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); + }); + }); +} + +/** + * Add a new registered server. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} serverId GUID identifying the on-premises server. + * + * @param {object} body Body of Registered Server object. + * + * @param {string} [body.serverCertificate] Registered Server Certificate + * + * @param {string} [body.agentVersion] Registered Server Agent Version + * + * @param {string} [body.serverOSVersion] Registered Server OS Version + * + * @param {number} [body.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [body.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [body.provisioningState] Registered Server Provisioning + * State + * + * @param {string} [body.serverRole] Registered Server serverRole + * + * @param {string} [body.clusterId] Registered Server clusterId + * + * @param {string} [body.clusterName] Registered Server clusterName + * + * @param {string} [body.serverId] Registered Server serverId + * + * @param {string} [body.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [body.lastWorkflowId] Registered Server lastWorkflowId + * + * @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 RegisteredServer} 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, storageSyncServiceName, serverId, body, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName cannot be null or undefined and it must be of type string.'); + } + if (serverId === null || serverId === undefined || typeof serverId.valueOf() !== 'string') { + throw new Error('serverId cannot be null or undefined and it must be of type string.'); + } + if (body === null || body === undefined) { + throw new Error('body 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.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + requestUrl = requestUrl.replace('{serverId}', encodeURIComponent(serverId)); + 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 (body !== null && body !== undefined) { + let requestModelMapper = new client.models['RegisteredServer']().mapper(); + requestModel = client.serialize(requestModelMapper, body, 'body'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(body, 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['ErrorModel']().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['RegisteredServer']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Delete the given registered server. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} serverId GUID identifying the on-premises server. + * + * @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, storageSyncServiceName, serverId, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName cannot be null or undefined and it must be of type string.'); + } + if (serverId === null || serverId === undefined || typeof serverId.valueOf() !== 'string') { + throw new Error('serverId 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.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + requestUrl = requestUrl.replace('{serverId}', encodeURIComponent(serverId)); + 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 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['ErrorModel']().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 RegisteredServers. */ +class RegisteredServers { + /** + * Create a RegisteredServers. + * @param {MicrosoftStorageSync} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._create = _create; + this._deleteMethod = _deleteMethod; + this._beginCreate = _beginCreate; + this._beginDeleteMethod = _beginDeleteMethod; + } + + /** + * Get a given registered server. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} serverId GUID identifying the on-premises server. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, storageSyncServiceName, serverId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, storageSyncServiceName, serverId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get a given registered server. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} serverId GUID identifying the on-premises server. + * + * @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 {RegisteredServer} - 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 RegisteredServer} 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, storageSyncServiceName, serverId, 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, storageSyncServiceName, serverId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, storageSyncServiceName, serverId, options, optionalCallback); + } + } + + /** + * Add a new registered server. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} serverId GUID identifying the on-premises server. + * + * @param {object} body Body of Registered Server object. + * + * @param {string} [body.serverCertificate] Registered Server Certificate + * + * @param {string} [body.agentVersion] Registered Server Agent Version + * + * @param {string} [body.serverOSVersion] Registered Server OS Version + * + * @param {number} [body.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [body.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [body.provisioningState] Registered Server Provisioning + * State + * + * @param {string} [body.serverRole] Registered Server serverRole + * + * @param {string} [body.clusterId] Registered Server clusterId + * + * @param {string} [body.clusterName] Registered Server clusterName + * + * @param {string} [body.serverId] Registered Server serverId + * + * @param {string} [body.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [body.lastWorkflowId] Registered Server lastWorkflowId + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, storageSyncServiceName, serverId, body, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._create(resourceGroupName, storageSyncServiceName, serverId, body, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Add a new registered server. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} serverId GUID identifying the on-premises server. + * + * @param {object} body Body of Registered Server object. + * + * @param {string} [body.serverCertificate] Registered Server Certificate + * + * @param {string} [body.agentVersion] Registered Server Agent Version + * + * @param {string} [body.serverOSVersion] Registered Server OS Version + * + * @param {number} [body.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [body.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [body.provisioningState] Registered Server Provisioning + * State + * + * @param {string} [body.serverRole] Registered Server serverRole + * + * @param {string} [body.clusterId] Registered Server clusterId + * + * @param {string} [body.clusterName] Registered Server clusterName + * + * @param {string} [body.serverId] Registered Server serverId + * + * @param {string} [body.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [body.lastWorkflowId] Registered Server lastWorkflowId + * + * @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 {RegisteredServer} - 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 RegisteredServer} 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. + */ + create(resourceGroupName, storageSyncServiceName, serverId, body, 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, storageSyncServiceName, serverId, body, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, storageSyncServiceName, serverId, body, options, optionalCallback); + } + } + + /** + * Delete the given registered server. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} serverId GUID identifying the on-premises server. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, storageSyncServiceName, serverId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, storageSyncServiceName, serverId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete the given registered server. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} serverId GUID identifying the on-premises server. + * + * @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, storageSyncServiceName, serverId, 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, storageSyncServiceName, serverId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, storageSyncServiceName, serverId, options, optionalCallback); + } + } + + /** + * Add a new registered server. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} serverId GUID identifying the on-premises server. + * + * @param {object} body Body of Registered Server object. + * + * @param {string} [body.serverCertificate] Registered Server Certificate + * + * @param {string} [body.agentVersion] Registered Server Agent Version + * + * @param {string} [body.serverOSVersion] Registered Server OS Version + * + * @param {number} [body.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [body.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [body.provisioningState] Registered Server Provisioning + * State + * + * @param {string} [body.serverRole] Registered Server serverRole + * + * @param {string} [body.clusterId] Registered Server clusterId + * + * @param {string} [body.clusterName] Registered Server clusterName + * + * @param {string} [body.serverId] Registered Server serverId + * + * @param {string} [body.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [body.lastWorkflowId] Registered Server lastWorkflowId + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, storageSyncServiceName, serverId, body, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreate(resourceGroupName, storageSyncServiceName, serverId, body, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Add a new registered server. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} serverId GUID identifying the on-premises server. + * + * @param {object} body Body of Registered Server object. + * + * @param {string} [body.serverCertificate] Registered Server Certificate + * + * @param {string} [body.agentVersion] Registered Server Agent Version + * + * @param {string} [body.serverOSVersion] Registered Server OS Version + * + * @param {number} [body.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [body.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [body.provisioningState] Registered Server Provisioning + * State + * + * @param {string} [body.serverRole] Registered Server serverRole + * + * @param {string} [body.clusterId] Registered Server clusterId + * + * @param {string} [body.clusterName] Registered Server clusterName + * + * @param {string} [body.serverId] Registered Server serverId + * + * @param {string} [body.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [body.lastWorkflowId] Registered Server lastWorkflowId + * + * @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 {RegisteredServer} - 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 RegisteredServer} 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, storageSyncServiceName, serverId, body, 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, storageSyncServiceName, serverId, body, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreate(resourceGroupName, storageSyncServiceName, serverId, body, options, optionalCallback); + } + } + + /** + * Delete the given registered server. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} serverId GUID identifying the on-premises server. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, storageSyncServiceName, serverId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, storageSyncServiceName, serverId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete the given registered server. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} serverId GUID identifying the on-premises server. + * + * @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, storageSyncServiceName, serverId, 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, storageSyncServiceName, serverId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, storageSyncServiceName, serverId, options, optionalCallback); + } + } + +} + +module.exports = RegisteredServers; diff --git a/lib/services/storagesyncManagement/lib/operations/registeredServersGet.js b/lib/services/storagesyncManagement/lib/operations/registeredServersGet.js new file mode 100644 index 0000000000..83f1b8b717 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/registeredServersGet.js @@ -0,0 +1,282 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Get a given registered server list. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RegisteredServerArray} 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 _listByStorageSyncService(resourceGroupName, storageSyncServiceName, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName 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.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + 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['ErrorModel']().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['RegisteredServerArray']().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 RegisteredServersGet. */ +class RegisteredServersGet { + /** + * Create a RegisteredServersGet. + * @param {MicrosoftStorageSync} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listByStorageSyncService = _listByStorageSyncService; + } + + /** + * Get a given registered server list. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByStorageSyncServiceWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByStorageSyncService(resourceGroupName, storageSyncServiceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get a given registered server list. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {RegisteredServerArray} - 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 RegisteredServerArray} 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. + */ + listByStorageSyncService(resourceGroupName, storageSyncServiceName, 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._listByStorageSyncService(resourceGroupName, storageSyncServiceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByStorageSyncService(resourceGroupName, storageSyncServiceName, options, optionalCallback); + } + } + +} + +module.exports = RegisteredServersGet; diff --git a/lib/services/storagesyncManagement/lib/operations/serverEndpointRecall.js b/lib/services/storagesyncManagement/lib/operations/serverEndpointRecall.js new file mode 100644 index 0000000000..1181ff5576 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/serverEndpointRecall.js @@ -0,0 +1,450 @@ +/* + * 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; + + +/** + * Recall a serverendpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @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 _post(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, 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.beginPost(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, 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); + }); + }); +} + +/** + * Recall a serverendpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @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 _beginPost(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName cannot be null or undefined and it must be of type string.'); + } + if (syncGroupName === null || syncGroupName === undefined || typeof syncGroupName.valueOf() !== 'string') { + throw new Error('syncGroupName cannot be null or undefined and it must be of type string.'); + } + if (serverEndpointName === null || serverEndpointName === undefined || typeof serverEndpointName.valueOf() !== 'string') { + throw new Error('serverEndpointName 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.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}/recallAction'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + requestUrl = requestUrl.replace('{syncGroupName}', encodeURIComponent(syncGroupName)); + requestUrl = requestUrl.replace('{serverEndpointName}', encodeURIComponent(serverEndpointName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['ErrorModel']().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 ServerEndpointRecall. */ +class ServerEndpointRecall { + /** + * Create a ServerEndpointRecall. + * @param {MicrosoftStorageSync} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._post = _post; + this._beginPost = _beginPost; + } + + /** + * Recall a serverendpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + postWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._post(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Recall a serverendpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @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. + */ + post(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, 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._post(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._post(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, optionalCallback); + } + } + + /** + * Recall a serverendpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + beginPostWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginPost(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Recall a serverendpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @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. + */ + beginPost(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, 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._beginPost(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginPost(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, optionalCallback); + } + } + +} + +module.exports = ServerEndpointRecall; diff --git a/lib/services/storagesyncManagement/lib/operations/serverEndpoints.js b/lib/services/storagesyncManagement/lib/operations/serverEndpoints.js new file mode 100644 index 0000000000..ada09c7940 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/serverEndpoints.js @@ -0,0 +1,2255 @@ +/* + * 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; + + +/** + * Create a new ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @param {object} body Body of Server Endpoint object. + * + * @param {string} [body.serverLocalPath] Server Local path. + * + * @param {string} [body.cloudTiering] Cloud Tiering. Possible values include: + * 'on', 'off' + * + * @param {number} [body.volumeFreeSpacePercent] Level of free space to be + * maintained by Cloud Tiering if it is enabled. + * + * @param {string} [body.friendlyName] Friendly Name + * + * @param {date} [body.lastSyncSuccess] Last Sync Success + * + * @param {string} [body.syncErrorState] Sync Error State + * + * @param {date} [body.syncErrorStateTimestamp] Sync Error State Timestamp + * + * @param {string} [body.syncErrorDirection] Sync Error Direction. Possible + * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * + * @param {number} [body.itemUploadErrorCount] Item Upload Error Count. + * + * @param {number} [body.itemDownloadErrorCount] Item download error count. + * + * @param {string} [body.syncErrorContext] sync error context. + * + * @param {string} [body.currentProgressType] current progress type. Possible + * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * + * @param {number} [body.itemProgressCount] Item Progress Count + * + * @param {number} [body.itemTotalCount] Item Total Count + * + * @param {number} [body.byteProgress] Bytes in progress + * + * @param {number} [body.totalProgress] Total progress + * + * @param {number} [body.byteTotal] Bytes total + * + * @param {string} [body.serverResourceId] Server Resource Id. + * + * @param {string} [body.provisioningState] ServerEndpoint Provisioning State + * + * @param {string} [body.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @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 ServerEndpoint} 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 _create(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, body, 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, storageSyncServiceName, syncGroupName, serverEndpointName, body, 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['ServerEndpoint']().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); + }); + }); +} + + +/** + * Patch a given ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.body] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.body.serverLocalPath] Server Local path. + * + * @param {string} [options.body.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [options.body.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.body.friendlyName] Friendly Name + * + * @param {date} [options.body.lastSyncSuccess] Last Sync Success + * + * @param {string} [options.body.syncErrorState] Sync Error State + * + * @param {date} [options.body.syncErrorStateTimestamp] Sync Error State + * Timestamp + * + * @param {string} [options.body.syncErrorDirection] Sync Error Direction. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [options.body.itemUploadErrorCount] Item Upload Error Count. + * + * @param {number} [options.body.itemDownloadErrorCount] Item download error + * count. + * + * @param {string} [options.body.syncErrorContext] sync error context. + * + * @param {string} [options.body.currentProgressType] current progress type. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [options.body.itemProgressCount] Item Progress Count + * + * @param {number} [options.body.itemTotalCount] Item Total Count + * + * @param {number} [options.body.byteProgress] Bytes in progress + * + * @param {number} [options.body.totalProgress] Total progress + * + * @param {number} [options.body.byteTotal] Bytes total + * + * @param {string} [options.body.serverResourceId] Server Resource Id. + * + * @param {string} [options.body.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [options.body.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @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 ServerEndpoint} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, 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.beginUpdate(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, 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['ServerEndpoint']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Get a ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @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 ServerEndpoint} 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, storageSyncServiceName, syncGroupName, serverEndpointName, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName cannot be null or undefined and it must be of type string.'); + } + if (syncGroupName === null || syncGroupName === undefined || typeof syncGroupName.valueOf() !== 'string') { + throw new Error('syncGroupName cannot be null or undefined and it must be of type string.'); + } + if (serverEndpointName === null || serverEndpointName === undefined || typeof serverEndpointName.valueOf() !== 'string') { + throw new Error('serverEndpointName 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.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + requestUrl = requestUrl.replace('{syncGroupName}', encodeURIComponent(syncGroupName)); + requestUrl = requestUrl.replace('{serverEndpointName}', encodeURIComponent(serverEndpointName)); + 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['ErrorModel']().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['ServerEndpoint']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Delete a given ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @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, storageSyncServiceName, syncGroupName, serverEndpointName, 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, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Create a new ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @param {object} body Body of Server Endpoint object. + * + * @param {string} [body.serverLocalPath] Server Local path. + * + * @param {string} [body.cloudTiering] Cloud Tiering. Possible values include: + * 'on', 'off' + * + * @param {number} [body.volumeFreeSpacePercent] Level of free space to be + * maintained by Cloud Tiering if it is enabled. + * + * @param {string} [body.friendlyName] Friendly Name + * + * @param {date} [body.lastSyncSuccess] Last Sync Success + * + * @param {string} [body.syncErrorState] Sync Error State + * + * @param {date} [body.syncErrorStateTimestamp] Sync Error State Timestamp + * + * @param {string} [body.syncErrorDirection] Sync Error Direction. Possible + * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * + * @param {number} [body.itemUploadErrorCount] Item Upload Error Count. + * + * @param {number} [body.itemDownloadErrorCount] Item download error count. + * + * @param {string} [body.syncErrorContext] sync error context. + * + * @param {string} [body.currentProgressType] current progress type. Possible + * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * + * @param {number} [body.itemProgressCount] Item Progress Count + * + * @param {number} [body.itemTotalCount] Item Total Count + * + * @param {number} [body.byteProgress] Bytes in progress + * + * @param {number} [body.totalProgress] Total progress + * + * @param {number} [body.byteTotal] Bytes total + * + * @param {string} [body.serverResourceId] Server Resource Id. + * + * @param {string} [body.provisioningState] ServerEndpoint Provisioning State + * + * @param {string} [body.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @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 ServerEndpoint} 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, storageSyncServiceName, syncGroupName, serverEndpointName, body, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName cannot be null or undefined and it must be of type string.'); + } + if (syncGroupName === null || syncGroupName === undefined || typeof syncGroupName.valueOf() !== 'string') { + throw new Error('syncGroupName cannot be null or undefined and it must be of type string.'); + } + if (serverEndpointName === null || serverEndpointName === undefined || typeof serverEndpointName.valueOf() !== 'string') { + throw new Error('serverEndpointName cannot be null or undefined and it must be of type string.'); + } + if (body === null || body === undefined) { + throw new Error('body 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.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + requestUrl = requestUrl.replace('{syncGroupName}', encodeURIComponent(syncGroupName)); + requestUrl = requestUrl.replace('{serverEndpointName}', encodeURIComponent(serverEndpointName)); + 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 (body !== null && body !== undefined) { + let requestModelMapper = new client.models['ServerEndpoint']().mapper(); + requestModel = client.serialize(requestModelMapper, body, 'body'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(body, 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['ErrorModel']().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['ServerEndpoint']().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); + }); +} + +/** + * Patch a given ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.body] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.body.serverLocalPath] Server Local path. + * + * @param {string} [options.body.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [options.body.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.body.friendlyName] Friendly Name + * + * @param {date} [options.body.lastSyncSuccess] Last Sync Success + * + * @param {string} [options.body.syncErrorState] Sync Error State + * + * @param {date} [options.body.syncErrorStateTimestamp] Sync Error State + * Timestamp + * + * @param {string} [options.body.syncErrorDirection] Sync Error Direction. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [options.body.itemUploadErrorCount] Item Upload Error Count. + * + * @param {number} [options.body.itemDownloadErrorCount] Item download error + * count. + * + * @param {string} [options.body.syncErrorContext] sync error context. + * + * @param {string} [options.body.currentProgressType] current progress type. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [options.body.itemProgressCount] Item Progress Count + * + * @param {number} [options.body.itemTotalCount] Item Total Count + * + * @param {number} [options.body.byteProgress] Bytes in progress + * + * @param {number} [options.body.totalProgress] Total progress + * + * @param {number} [options.body.byteTotal] Bytes total + * + * @param {string} [options.body.serverResourceId] Server Resource Id. + * + * @param {string} [options.body.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [options.body.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @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 ServerEndpoint} 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 _beginUpdate(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let body = (options && options.body !== undefined) ? options.body : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName cannot be null or undefined and it must be of type string.'); + } + if (syncGroupName === null || syncGroupName === undefined || typeof syncGroupName.valueOf() !== 'string') { + throw new Error('syncGroupName cannot be null or undefined and it must be of type string.'); + } + if (serverEndpointName === null || serverEndpointName === undefined || typeof serverEndpointName.valueOf() !== 'string') { + throw new Error('serverEndpointName 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.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + requestUrl = requestUrl.replace('{syncGroupName}', encodeURIComponent(syncGroupName)); + requestUrl = requestUrl.replace('{serverEndpointName}', encodeURIComponent(serverEndpointName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (body !== null && body !== undefined) { + let requestModelMapper = new client.models['ServerEndpoint']().mapper(); + requestModel = client.serialize(requestModelMapper, body, 'body'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(body, 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['ErrorModel']().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['ServerEndpoint']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Delete a given ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @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, storageSyncServiceName, syncGroupName, serverEndpointName, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName cannot be null or undefined and it must be of type string.'); + } + if (syncGroupName === null || syncGroupName === undefined || typeof syncGroupName.valueOf() !== 'string') { + throw new Error('syncGroupName cannot be null or undefined and it must be of type string.'); + } + if (serverEndpointName === null || serverEndpointName === undefined || typeof serverEndpointName.valueOf() !== 'string') { + throw new Error('serverEndpointName 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.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + requestUrl = requestUrl.replace('{syncGroupName}', encodeURIComponent(syncGroupName)); + requestUrl = requestUrl.replace('{serverEndpointName}', encodeURIComponent(serverEndpointName)); + 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['ErrorModel']().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 ServerEndpoints. */ +class ServerEndpoints { + /** + * Create a ServerEndpoints. + * @param {MicrosoftStorageSync} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._create = _create; + this._update = _update; + this._get = _get; + this._deleteMethod = _deleteMethod; + this._beginCreate = _beginCreate; + this._beginUpdate = _beginUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + } + + /** + * Create a new ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @param {object} body Body of Server Endpoint object. + * + * @param {string} [body.serverLocalPath] Server Local path. + * + * @param {string} [body.cloudTiering] Cloud Tiering. Possible values include: + * 'on', 'off' + * + * @param {number} [body.volumeFreeSpacePercent] Level of free space to be + * maintained by Cloud Tiering if it is enabled. + * + * @param {string} [body.friendlyName] Friendly Name + * + * @param {date} [body.lastSyncSuccess] Last Sync Success + * + * @param {string} [body.syncErrorState] Sync Error State + * + * @param {date} [body.syncErrorStateTimestamp] Sync Error State Timestamp + * + * @param {string} [body.syncErrorDirection] Sync Error Direction. Possible + * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * + * @param {number} [body.itemUploadErrorCount] Item Upload Error Count. + * + * @param {number} [body.itemDownloadErrorCount] Item download error count. + * + * @param {string} [body.syncErrorContext] sync error context. + * + * @param {string} [body.currentProgressType] current progress type. Possible + * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * + * @param {number} [body.itemProgressCount] Item Progress Count + * + * @param {number} [body.itemTotalCount] Item Total Count + * + * @param {number} [body.byteProgress] Bytes in progress + * + * @param {number} [body.totalProgress] Total progress + * + * @param {number} [body.byteTotal] Bytes total + * + * @param {string} [body.serverResourceId] Server Resource Id. + * + * @param {string} [body.provisioningState] ServerEndpoint Provisioning State + * + * @param {string} [body.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, storageSyncServiceName, syncGroupName, serverEndpointName, body, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._create(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, body, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create a new ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @param {object} body Body of Server Endpoint object. + * + * @param {string} [body.serverLocalPath] Server Local path. + * + * @param {string} [body.cloudTiering] Cloud Tiering. Possible values include: + * 'on', 'off' + * + * @param {number} [body.volumeFreeSpacePercent] Level of free space to be + * maintained by Cloud Tiering if it is enabled. + * + * @param {string} [body.friendlyName] Friendly Name + * + * @param {date} [body.lastSyncSuccess] Last Sync Success + * + * @param {string} [body.syncErrorState] Sync Error State + * + * @param {date} [body.syncErrorStateTimestamp] Sync Error State Timestamp + * + * @param {string} [body.syncErrorDirection] Sync Error Direction. Possible + * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * + * @param {number} [body.itemUploadErrorCount] Item Upload Error Count. + * + * @param {number} [body.itemDownloadErrorCount] Item download error count. + * + * @param {string} [body.syncErrorContext] sync error context. + * + * @param {string} [body.currentProgressType] current progress type. Possible + * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * + * @param {number} [body.itemProgressCount] Item Progress Count + * + * @param {number} [body.itemTotalCount] Item Total Count + * + * @param {number} [body.byteProgress] Bytes in progress + * + * @param {number} [body.totalProgress] Total progress + * + * @param {number} [body.byteTotal] Bytes total + * + * @param {string} [body.serverResourceId] Server Resource Id. + * + * @param {string} [body.provisioningState] ServerEndpoint Provisioning State + * + * @param {string} [body.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @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 {ServerEndpoint} - 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 ServerEndpoint} 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. + */ + create(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, body, 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, storageSyncServiceName, syncGroupName, serverEndpointName, body, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, body, options, optionalCallback); + } + } + + /** + * Patch a given ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.body] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.body.serverLocalPath] Server Local path. + * + * @param {string} [options.body.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [options.body.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.body.friendlyName] Friendly Name + * + * @param {date} [options.body.lastSyncSuccess] Last Sync Success + * + * @param {string} [options.body.syncErrorState] Sync Error State + * + * @param {date} [options.body.syncErrorStateTimestamp] Sync Error State + * Timestamp + * + * @param {string} [options.body.syncErrorDirection] Sync Error Direction. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [options.body.itemUploadErrorCount] Item Upload Error Count. + * + * @param {number} [options.body.itemDownloadErrorCount] Item download error + * count. + * + * @param {string} [options.body.syncErrorContext] sync error context. + * + * @param {string} [options.body.currentProgressType] current progress type. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [options.body.itemProgressCount] Item Progress Count + * + * @param {number} [options.body.itemTotalCount] Item Total Count + * + * @param {number} [options.body.byteProgress] Bytes in progress + * + * @param {number} [options.body.totalProgress] Total progress + * + * @param {number} [options.body.byteTotal] Bytes total + * + * @param {string} [options.body.serverResourceId] Server Resource Id. + * + * @param {string} [options.body.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [options.body.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Patch a given ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.body] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.body.serverLocalPath] Server Local path. + * + * @param {string} [options.body.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [options.body.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.body.friendlyName] Friendly Name + * + * @param {date} [options.body.lastSyncSuccess] Last Sync Success + * + * @param {string} [options.body.syncErrorState] Sync Error State + * + * @param {date} [options.body.syncErrorStateTimestamp] Sync Error State + * Timestamp + * + * @param {string} [options.body.syncErrorDirection] Sync Error Direction. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [options.body.itemUploadErrorCount] Item Upload Error Count. + * + * @param {number} [options.body.itemDownloadErrorCount] Item download error + * count. + * + * @param {string} [options.body.syncErrorContext] sync error context. + * + * @param {string} [options.body.currentProgressType] current progress type. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [options.body.itemProgressCount] Item Progress Count + * + * @param {number} [options.body.itemTotalCount] Item Total Count + * + * @param {number} [options.body.byteProgress] Bytes in progress + * + * @param {number} [options.body.totalProgress] Total progress + * + * @param {number} [options.body.byteTotal] Bytes total + * + * @param {string} [options.body.serverResourceId] Server Resource Id. + * + * @param {string} [options.body.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [options.body.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @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 {ServerEndpoint} - 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 ServerEndpoint} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, optionalCallback); + } + } + + /** + * Get a ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, storageSyncServiceName, syncGroupName, serverEndpointName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get a ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @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 {ServerEndpoint} - 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 ServerEndpoint} 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, storageSyncServiceName, syncGroupName, serverEndpointName, 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, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, optionalCallback); + } + } + + /** + * Delete a given ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, storageSyncServiceName, syncGroupName, serverEndpointName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete a given ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @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, storageSyncServiceName, syncGroupName, serverEndpointName, 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, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, optionalCallback); + } + } + + /** + * Create a new ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @param {object} body Body of Server Endpoint object. + * + * @param {string} [body.serverLocalPath] Server Local path. + * + * @param {string} [body.cloudTiering] Cloud Tiering. Possible values include: + * 'on', 'off' + * + * @param {number} [body.volumeFreeSpacePercent] Level of free space to be + * maintained by Cloud Tiering if it is enabled. + * + * @param {string} [body.friendlyName] Friendly Name + * + * @param {date} [body.lastSyncSuccess] Last Sync Success + * + * @param {string} [body.syncErrorState] Sync Error State + * + * @param {date} [body.syncErrorStateTimestamp] Sync Error State Timestamp + * + * @param {string} [body.syncErrorDirection] Sync Error Direction. Possible + * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * + * @param {number} [body.itemUploadErrorCount] Item Upload Error Count. + * + * @param {number} [body.itemDownloadErrorCount] Item download error count. + * + * @param {string} [body.syncErrorContext] sync error context. + * + * @param {string} [body.currentProgressType] current progress type. Possible + * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * + * @param {number} [body.itemProgressCount] Item Progress Count + * + * @param {number} [body.itemTotalCount] Item Total Count + * + * @param {number} [body.byteProgress] Bytes in progress + * + * @param {number} [body.totalProgress] Total progress + * + * @param {number} [body.byteTotal] Bytes total + * + * @param {string} [body.serverResourceId] Server Resource Id. + * + * @param {string} [body.provisioningState] ServerEndpoint Provisioning State + * + * @param {string} [body.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, storageSyncServiceName, syncGroupName, serverEndpointName, body, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, body, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create a new ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @param {object} body Body of Server Endpoint object. + * + * @param {string} [body.serverLocalPath] Server Local path. + * + * @param {string} [body.cloudTiering] Cloud Tiering. Possible values include: + * 'on', 'off' + * + * @param {number} [body.volumeFreeSpacePercent] Level of free space to be + * maintained by Cloud Tiering if it is enabled. + * + * @param {string} [body.friendlyName] Friendly Name + * + * @param {date} [body.lastSyncSuccess] Last Sync Success + * + * @param {string} [body.syncErrorState] Sync Error State + * + * @param {date} [body.syncErrorStateTimestamp] Sync Error State Timestamp + * + * @param {string} [body.syncErrorDirection] Sync Error Direction. Possible + * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * + * @param {number} [body.itemUploadErrorCount] Item Upload Error Count. + * + * @param {number} [body.itemDownloadErrorCount] Item download error count. + * + * @param {string} [body.syncErrorContext] sync error context. + * + * @param {string} [body.currentProgressType] current progress type. Possible + * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * + * @param {number} [body.itemProgressCount] Item Progress Count + * + * @param {number} [body.itemTotalCount] Item Total Count + * + * @param {number} [body.byteProgress] Bytes in progress + * + * @param {number} [body.totalProgress] Total progress + * + * @param {number} [body.byteTotal] Bytes total + * + * @param {string} [body.serverResourceId] Server Resource Id. + * + * @param {string} [body.provisioningState] ServerEndpoint Provisioning State + * + * @param {string} [body.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @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 {ServerEndpoint} - 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 ServerEndpoint} 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, storageSyncServiceName, syncGroupName, serverEndpointName, body, 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, storageSyncServiceName, syncGroupName, serverEndpointName, body, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, body, options, optionalCallback); + } + } + + /** + * Patch a given ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.body] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.body.serverLocalPath] Server Local path. + * + * @param {string} [options.body.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [options.body.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.body.friendlyName] Friendly Name + * + * @param {date} [options.body.lastSyncSuccess] Last Sync Success + * + * @param {string} [options.body.syncErrorState] Sync Error State + * + * @param {date} [options.body.syncErrorStateTimestamp] Sync Error State + * Timestamp + * + * @param {string} [options.body.syncErrorDirection] Sync Error Direction. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [options.body.itemUploadErrorCount] Item Upload Error Count. + * + * @param {number} [options.body.itemDownloadErrorCount] Item download error + * count. + * + * @param {string} [options.body.syncErrorContext] sync error context. + * + * @param {string} [options.body.currentProgressType] current progress type. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [options.body.itemProgressCount] Item Progress Count + * + * @param {number} [options.body.itemTotalCount] Item Total Count + * + * @param {number} [options.body.byteProgress] Bytes in progress + * + * @param {number} [options.body.totalProgress] Total progress + * + * @param {number} [options.body.byteTotal] Bytes total + * + * @param {string} [options.body.serverResourceId] Server Resource Id. + * + * @param {string} [options.body.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [options.body.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @param {object} [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. + */ + beginUpdateWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginUpdate(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Patch a given ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.body] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.body.serverLocalPath] Server Local path. + * + * @param {string} [options.body.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [options.body.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.body.friendlyName] Friendly Name + * + * @param {date} [options.body.lastSyncSuccess] Last Sync Success + * + * @param {string} [options.body.syncErrorState] Sync Error State + * + * @param {date} [options.body.syncErrorStateTimestamp] Sync Error State + * Timestamp + * + * @param {string} [options.body.syncErrorDirection] Sync Error Direction. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [options.body.itemUploadErrorCount] Item Upload Error Count. + * + * @param {number} [options.body.itemDownloadErrorCount] Item download error + * count. + * + * @param {string} [options.body.syncErrorContext] sync error context. + * + * @param {string} [options.body.currentProgressType] current progress type. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [options.body.itemProgressCount] Item Progress Count + * + * @param {number} [options.body.itemTotalCount] Item Total Count + * + * @param {number} [options.body.byteProgress] Bytes in progress + * + * @param {number} [options.body.totalProgress] Total progress + * + * @param {number} [options.body.byteTotal] Bytes total + * + * @param {string} [options.body.serverResourceId] Server Resource Id. + * + * @param {string} [options.body.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [options.body.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @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 {ServerEndpoint} - 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 ServerEndpoint} 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. + */ + beginUpdate(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, 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._beginUpdate(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginUpdate(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, optionalCallback); + } + } + + /** + * Delete a given ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, storageSyncServiceName, syncGroupName, serverEndpointName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete a given ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @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, storageSyncServiceName, syncGroupName, serverEndpointName, 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, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, optionalCallback); + } + } + +} + +module.exports = ServerEndpoints; diff --git a/lib/services/storagesyncManagement/lib/operations/serverEndpointsGet.js b/lib/services/storagesyncManagement/lib/operations/serverEndpointsGet.js new file mode 100644 index 0000000000..929d6bcaf8 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/serverEndpointsGet.js @@ -0,0 +1,292 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Get a ServerEndpoint list. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ServerEndpointArray} 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 _listBySyncGroup(resourceGroupName, storageSyncServiceName, syncGroupName, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName cannot be null or undefined and it must be of type string.'); + } + if (syncGroupName === null || syncGroupName === undefined || typeof syncGroupName.valueOf() !== 'string') { + throw new Error('syncGroupName 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.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + requestUrl = requestUrl.replace('{syncGroupName}', encodeURIComponent(syncGroupName)); + 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['ErrorModel']().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['ServerEndpointArray']().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 ServerEndpointsGet. */ +class ServerEndpointsGet { + /** + * Create a ServerEndpointsGet. + * @param {MicrosoftStorageSync} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listBySyncGroup = _listBySyncGroup; + } + + /** + * Get a ServerEndpoint list. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listBySyncGroupWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listBySyncGroup(resourceGroupName, storageSyncServiceName, syncGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get a ServerEndpoint list. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ServerEndpointArray} - 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 ServerEndpointArray} 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. + */ + listBySyncGroup(resourceGroupName, storageSyncServiceName, syncGroupName, 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._listBySyncGroup(resourceGroupName, storageSyncServiceName, syncGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listBySyncGroup(resourceGroupName, storageSyncServiceName, syncGroupName, options, optionalCallback); + } + } + +} + +module.exports = ServerEndpointsGet; diff --git a/lib/services/storagesyncManagement/lib/operations/storageSyncServiceByResourceGroupGet.js b/lib/services/storagesyncManagement/lib/operations/storageSyncServiceByResourceGroupGet.js new file mode 100644 index 0000000000..5579a0c7f9 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/storageSyncServiceByResourceGroupGet.js @@ -0,0 +1,271 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Get a StorageSyncService list by Resource group name. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @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 StorageSyncServiceArray} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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.StorageSync/storageSyncServices'; + 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) { + 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['ErrorModel']().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['StorageSyncServiceArray']().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 StorageSyncServiceByResourceGroupGet. */ +class StorageSyncServiceByResourceGroupGet { + /** + * Create a StorageSyncServiceByResourceGroupGet. + * @param {MicrosoftStorageSync} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + } + + /** + * Get a StorageSyncService list by Resource group name. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get a StorageSyncService list by Resource group name. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @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 {StorageSyncServiceArray} - 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 StorageSyncServiceArray} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, options, optionalCallback); + } + } + +} + +module.exports = StorageSyncServiceByResourceGroupGet; diff --git a/lib/services/storagesyncManagement/lib/operations/storageSyncServiceGet.js b/lib/services/storagesyncManagement/lib/operations/storageSyncServiceGet.js new file mode 100644 index 0000000000..13407135c4 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/storageSyncServiceGet.js @@ -0,0 +1,244 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Get a StorageSyncService list by subscription. + * + * @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 StorageSyncServiceArray} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listBySubscription(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // 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 (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.StorageSync/storageSyncServices'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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['ErrorModel']().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['StorageSyncServiceArray']().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 StorageSyncServiceGet. */ +class StorageSyncServiceGet { + /** + * Create a StorageSyncServiceGet. + * @param {MicrosoftStorageSync} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listBySubscription = _listBySubscription; + } + + /** + * Get a StorageSyncService list by subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listBySubscriptionWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listBySubscription(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get a StorageSyncService list by subscription. + * + * @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 {StorageSyncServiceArray} - 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 StorageSyncServiceArray} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listBySubscription(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listBySubscription(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listBySubscription(options, optionalCallback); + } + } + +} + +module.exports = StorageSyncServiceGet; diff --git a/lib/services/storagesyncManagement/lib/operations/storageSyncServices.js b/lib/services/storagesyncManagement/lib/operations/storageSyncServices.js new file mode 100644 index 0000000000..dcde786798 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/storageSyncServices.js @@ -0,0 +1,1066 @@ +/* + * 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; + +/** + * Create a new StorageSyncService. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {object} body Storage Sync Service resource 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. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link StorageSyncService} 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 _create(resourceGroupName, storageSyncServiceName, body, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName cannot be null or undefined and it must be of type string.'); + } + if (body === null || body === undefined) { + throw new Error('body 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.StorageSync/storageSyncServices/{storageSyncServiceName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + 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 (body !== null && body !== undefined) { + let requestModelMapper = new client.models['StorageSyncService']().mapper(); + requestModel = client.serialize(requestModelMapper, body, 'body'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(body, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['ErrorModel']().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['StorageSyncService']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Get a given StorageSyncService. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link StorageSyncService} 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, storageSyncServiceName, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + if (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName 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.StorageSync/storageSyncServices/{storageSyncServiceName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + 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['ErrorModel']().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['StorageSyncService']().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); + }); +} + +/** + * Patch a given StorageSyncService. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.body] Storage Sync Service resource. + * + * @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 StorageSyncService} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, storageSyncServiceName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let body = (options && options.body !== undefined) ? options.body : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName 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.StorageSync/storageSyncServices/{storageSyncServiceName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (body !== null && body !== undefined) { + let requestModelMapper = new client.models['StorageSyncService']().mapper(); + requestModel = client.serialize(requestModelMapper, body, 'body'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(body, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['ErrorModel']().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['StorageSyncService']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Delete a given StorageSyncService. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, storageSyncServiceName, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName 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.StorageSync/storageSyncServices/{storageSyncServiceName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['ErrorModel']().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 StorageSyncServices. */ +class StorageSyncServices { + /** + * Create a StorageSyncServices. + * @param {MicrosoftStorageSync} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._create = _create; + this._get = _get; + this._update = _update; + this._deleteMethod = _deleteMethod; + } + + /** + * Create a new StorageSyncService. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {object} body Storage Sync Service resource name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, storageSyncServiceName, body, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._create(resourceGroupName, storageSyncServiceName, body, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create a new StorageSyncService. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {object} body Storage Sync Service resource name. + * + * @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 {StorageSyncService} - 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 StorageSyncService} 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. + */ + create(resourceGroupName, storageSyncServiceName, body, 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, storageSyncServiceName, body, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, storageSyncServiceName, body, options, optionalCallback); + } + } + + /** + * Get a given StorageSyncService. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, storageSyncServiceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get a given StorageSyncService. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {StorageSyncService} - 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 StorageSyncService} 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, storageSyncServiceName, 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, storageSyncServiceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, storageSyncServiceName, options, optionalCallback); + } + } + + /** + * Patch a given StorageSyncService. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.body] Storage Sync Service resource. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, storageSyncServiceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Patch a given StorageSyncService. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.body] Storage Sync Service resource. + * + * @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 {StorageSyncService} - 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 StorageSyncService} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName, storageSyncServiceName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, storageSyncServiceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, storageSyncServiceName, options, optionalCallback); + } + } + + /** + * Delete a given StorageSyncService. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, storageSyncServiceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete a given StorageSyncService. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, storageSyncServiceName, 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, storageSyncServiceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, storageSyncServiceName, options, optionalCallback); + } + } + +} + +module.exports = StorageSyncServices; diff --git a/lib/services/storagesyncManagement/lib/operations/syncGroups.js b/lib/services/storagesyncManagement/lib/operations/syncGroups.js new file mode 100644 index 0000000000..526ab67714 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/syncGroups.js @@ -0,0 +1,828 @@ +/* + * 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; + +/** + * Create a new SyncGroup. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {object} body Sync Group Body + * + * @param {string} [body.uniqueId] Unique Id + * + * @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 SyncGroup} 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 _create(resourceGroupName, storageSyncServiceName, syncGroupName, body, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName cannot be null or undefined and it must be of type string.'); + } + if (syncGroupName === null || syncGroupName === undefined || typeof syncGroupName.valueOf() !== 'string') { + throw new Error('syncGroupName cannot be null or undefined and it must be of type string.'); + } + if (body === null || body === undefined) { + throw new Error('body 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.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + requestUrl = requestUrl.replace('{syncGroupName}', encodeURIComponent(syncGroupName)); + 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 (body !== null && body !== undefined) { + let requestModelMapper = new client.models['SyncGroup']().mapper(); + requestModel = client.serialize(requestModelMapper, body, 'body'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(body, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['ErrorModel']().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['SyncGroup']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Get a given SyncGroup. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link SyncGroup} 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, storageSyncServiceName, syncGroupName, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName cannot be null or undefined and it must be of type string.'); + } + if (syncGroupName === null || syncGroupName === undefined || typeof syncGroupName.valueOf() !== 'string') { + throw new Error('syncGroupName 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.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + requestUrl = requestUrl.replace('{syncGroupName}', encodeURIComponent(syncGroupName)); + 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['ErrorModel']().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['SyncGroup']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Delete a given SyncGroup. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName cannot be null or undefined and it must be of type string.'); + } + if (syncGroupName === null || syncGroupName === undefined || typeof syncGroupName.valueOf() !== 'string') { + throw new Error('syncGroupName 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.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + requestUrl = requestUrl.replace('{syncGroupName}', encodeURIComponent(syncGroupName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['ErrorModel']().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 SyncGroups. */ +class SyncGroups { + /** + * Create a SyncGroups. + * @param {MicrosoftStorageSync} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._create = _create; + this._get = _get; + this._deleteMethod = _deleteMethod; + } + + /** + * Create a new SyncGroup. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {object} body Sync Group Body + * + * @param {string} [body.uniqueId] Unique Id + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, storageSyncServiceName, syncGroupName, body, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._create(resourceGroupName, storageSyncServiceName, syncGroupName, body, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create a new SyncGroup. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {object} body Sync Group Body + * + * @param {string} [body.uniqueId] Unique Id + * + * @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 {SyncGroup} - 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 SyncGroup} 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. + */ + create(resourceGroupName, storageSyncServiceName, syncGroupName, body, 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, storageSyncServiceName, syncGroupName, body, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, storageSyncServiceName, syncGroupName, body, options, optionalCallback); + } + } + + /** + * Get a given SyncGroup. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, storageSyncServiceName, syncGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get a given SyncGroup. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {SyncGroup} - 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 SyncGroup} 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, storageSyncServiceName, syncGroupName, 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, storageSyncServiceName, syncGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, storageSyncServiceName, syncGroupName, options, optionalCallback); + } + } + + /** + * Delete a given SyncGroup. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete a given SyncGroup. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, 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, storageSyncServiceName, syncGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, options, optionalCallback); + } + } + +} + +module.exports = SyncGroups; diff --git a/lib/services/storagesyncManagement/lib/operations/workflows.js b/lib/services/storagesyncManagement/lib/operations/workflows.js new file mode 100644 index 0000000000..ac3d5a6915 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/workflows.js @@ -0,0 +1,292 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Get Workflows resource + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} workflowId workflow Id + * + * @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 Workflow} 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, storageSyncServiceName, workflowId, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName cannot be null or undefined and it must be of type string.'); + } + if (workflowId === null || workflowId === undefined || typeof workflowId.valueOf() !== 'string') { + throw new Error('workflowId 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.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows/{workflowId}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + requestUrl = requestUrl.replace('{workflowId}', encodeURIComponent(workflowId)); + 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['ErrorModel']().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['Workflow']().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 Workflows. */ +class Workflows { + /** + * Create a Workflows. + * @param {MicrosoftStorageSync} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + } + + /** + * Get Workflows resource + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} workflowId workflow Id + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, storageSyncServiceName, workflowId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, storageSyncServiceName, workflowId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get Workflows resource + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} workflowId workflow Id + * + * @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 {Workflow} - 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 Workflow} 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, storageSyncServiceName, workflowId, 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, storageSyncServiceName, workflowId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, storageSyncServiceName, workflowId, options, optionalCallback); + } + } + +} + +module.exports = Workflows; diff --git a/lib/services/storagesyncManagement/package.json b/lib/services/storagesyncManagement/package.json new file mode 100644 index 0000000000..399c32cbe8 --- /dev/null +++ b/lib/services/storagesyncManagement/package.json @@ -0,0 +1,25 @@ +{ + "name": "azure-arm-storagesync", + "author": "Microsoft Corporation", + "description": "MicrosoftStorageSync Library with typescript type definitions for node", + "version": "1.0.0", + "dependencies": { + "ms-rest": "^2.3.3", + "ms-rest-azure": "^2.5.5" + }, + "keywords": [ + "node", + "azure" + ], + "license": "MIT", + "main": "./lib/microsoftStorageSync.js", + "types": "./lib/microsoftStorageSync.d.ts", + "homepage": "http://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" + } +} From 03aab8929ad0a2251383b7dc570f79e1356d45cf Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 12 Jun 2018 19:40:43 +0000 Subject: [PATCH 2/3] Generated from 3c0da5ba17ebd8d58d92118f5cd2137e7137f2bf extra comma extra comma in pauseWaitForSyncDrainTimePeriodInSeconds --- lib/services/storagesyncManagement/README.md | 10 +- .../lib/models/cloudEndpoint.js | 1 + .../lib/models/index.d.ts | 20 +- .../storagesyncManagement/lib/models/index.js | 4 +- .../lib/models/preRestoreRequest.js | 6 +- .../lib/models/restoreFileSpec.js | 1 + .../lib/models/storageSyncError.js | 74 + .../lib/models/storageSyncErrorDetails.js | 68 + .../lib/models/subscriptionState.js | 1 + .../lib/operations/cloudEndpoints.js | 3126 +++++++++++++++-- .../lib/operations/index.d.ts | 1057 +++--- .../lib/operations/index.js | 15 +- .../lib/operations/operations.js | 455 +++ .../lib/operations/registeredServers.js | 261 +- .../lib/operations/serverEndpoints.js | 1036 +++++- .../lib/operations/storageSyncServices.js | 467 ++- .../lib/operations/syncGroups.js | 261 +- .../lib/operations/workflows.js | 248 +- .../lib/storageSyncManagementClient.d.ts | 68 + .../lib/storageSyncManagementClient.js | 91 + .../storagesyncManagement/package.json | 6 +- 21 files changed, 6190 insertions(+), 1086 deletions(-) create mode 100644 lib/services/storagesyncManagement/lib/models/storageSyncError.js create mode 100644 lib/services/storagesyncManagement/lib/models/storageSyncErrorDetails.js create mode 100644 lib/services/storagesyncManagement/lib/operations/operations.js create mode 100644 lib/services/storagesyncManagement/lib/storageSyncManagementClient.d.ts create mode 100644 lib/services/storagesyncManagement/lib/storageSyncManagementClient.js diff --git a/lib/services/storagesyncManagement/README.md b/lib/services/storagesyncManagement/README.md index 77b2ddfa0a..266b0589d5 100644 --- a/lib/services/storagesyncManagement/README.md +++ b/lib/services/storagesyncManagement/README.md @@ -3,7 +3,7 @@ uid: azure-arm-storagesync summary: *content --- -# Microsoft Azure SDK for Node.js - MicrosoftStorageSync +# Microsoft Azure SDK for Node.js - StorageSyncManagementClient This project provides a Node.js package for accessing Azure. Right now it supports: - **Node.js version 6.x.x or higher** @@ -18,15 +18,15 @@ npm install azure-arm-storagesync ## How to use -### Authentication, client creation and list operationGet as an example. +### Authentication, client creation and list operations as an example. ```javascript const msRestAzure = require("ms-rest-azure"); -const MicrosoftStorageSync = require("azure-arm-storagesync"); +const StorageSyncManagementClient = require("azure-arm-storagesync"); msRestAzure.interactiveLogin().then((creds) => { const subscriptionId = ""; - const client = new MicrosoftStorageSync(creds, subscriptionId); - return client.operationGet.list().then((result) => { + const client = new StorageSyncManagementClient(creds, subscriptionId); + return client.operations.list().then((result) => { console.log("The result is:"); console.log(result); }); diff --git a/lib/services/storagesyncManagement/lib/models/cloudEndpoint.js b/lib/services/storagesyncManagement/lib/models/cloudEndpoint.js index 771fbdfa32..c4a7a1a1d5 100644 --- a/lib/services/storagesyncManagement/lib/models/cloudEndpoint.js +++ b/lib/services/storagesyncManagement/lib/models/cloudEndpoint.js @@ -100,6 +100,7 @@ class CloudEndpoint extends models['BaseResource'] { }, backupEnabled: { required: false, + readOnly: true, serializedName: 'properties.backupEnabled', type: { name: 'Boolean' diff --git a/lib/services/storagesyncManagement/lib/models/index.d.ts b/lib/services/storagesyncManagement/lib/models/index.d.ts index 3368f5159f..e263c38525 100644 --- a/lib/services/storagesyncManagement/lib/models/index.d.ts +++ b/lib/services/storagesyncManagement/lib/models/index.d.ts @@ -18,7 +18,7 @@ export { CloudError } from 'ms-rest-azure'; /** * @class - * Initializes a new instance of the ErrorDetails class. + * Initializes a new instance of the StorageSyncErrorDetails class. * @constructor * Error Details object. * @@ -26,7 +26,7 @@ export { CloudError } from 'ms-rest-azure'; * @member {string} [message] Error message of the given entry. * @member {string} [target] Target of the given entry. */ -export interface ErrorDetails { +export interface StorageSyncErrorDetails { code?: string; message?: string; target?: string; @@ -34,7 +34,7 @@ export interface ErrorDetails { /** * @class - * Initializes a new instance of the ErrorModel class. + * Initializes a new instance of the StorageSyncError class. * @constructor * Error type * @@ -45,10 +45,10 @@ export interface ErrorDetails { * @member {string} [details.message] Error message of the given entry. * @member {string} [details.target] Target of the given entry. */ -export interface ErrorModel { +export interface StorageSyncError { code?: string; message?: string; - details?: ErrorDetails; + details?: StorageSyncErrorDetails; } /** @@ -94,7 +94,7 @@ export interface TrackedResource extends Resource { */ export interface SubscriptionState { state?: string; - istransitioning?: boolean; + readonly istransitioning?: boolean; properties?: any; } @@ -151,7 +151,7 @@ export interface CloudEndpoint extends BaseResource { storageAccountTenantId?: string; partnershipId?: string; friendlyName?: string; - backupEnabled?: boolean; + readonly backupEnabled?: boolean; provisioningState?: string; lastWorkflowId?: string; } @@ -358,7 +358,7 @@ export interface OperationDisplayResource { */ export interface RestoreFileSpec { path?: string; - isdir?: boolean; + readonly isdir?: boolean; } /** @@ -404,7 +404,7 @@ export interface PostRestoreRequest { * @member {string} [backupMetadataPropertyBag] Pre Restore backup metadata * property bag. * @member {array} [restoreFileSpec] Pre Restore restore file spec array. - * @member {number} [pausewaitforsyncdraintimeperiodinseconds] Pre Restore + * @member {number} [pauseWaitForSyncDrainTimePeriodInSeconds] Pre Restore * pause wait for sync drain time period in seconds. */ export interface PreRestoreRequest { @@ -416,7 +416,7 @@ export interface PreRestoreRequest { sourceAzureFileShareUri?: string; backupMetadataPropertyBag?: string; restoreFileSpec?: RestoreFileSpec[]; - pausewaitforsyncdraintimeperiodinseconds?: number; + pauseWaitForSyncDrainTimePeriodInSeconds?: number; } /** diff --git a/lib/services/storagesyncManagement/lib/models/index.js b/lib/services/storagesyncManagement/lib/models/index.js index aabbb684aa..6c83dfd4ac 100644 --- a/lib/services/storagesyncManagement/lib/models/index.js +++ b/lib/services/storagesyncManagement/lib/models/index.js @@ -18,8 +18,8 @@ var msRestAzure = require('ms-rest-azure'); exports.BaseResource = msRestAzure.BaseResource; exports.CloudError = msRestAzure.CloudError; -exports.ErrorDetails = require('./errorDetails'); -exports.ErrorModel = require('./errorModel'); +exports.StorageSyncErrorDetails = require('./storageSyncErrorDetails'); +exports.StorageSyncError = require('./storageSyncError'); exports.Resource = require('./resource'); exports.TrackedResource = require('./trackedResource'); exports.SubscriptionState = require('./subscriptionState'); diff --git a/lib/services/storagesyncManagement/lib/models/preRestoreRequest.js b/lib/services/storagesyncManagement/lib/models/preRestoreRequest.js index 6578ef5480..3afda3c8b9 100644 --- a/lib/services/storagesyncManagement/lib/models/preRestoreRequest.js +++ b/lib/services/storagesyncManagement/lib/models/preRestoreRequest.js @@ -29,7 +29,7 @@ class PreRestoreRequest { * @member {string} [backupMetadataPropertyBag] Pre Restore backup metadata * property bag. * @member {array} [restoreFileSpec] Pre Restore restore file spec array. - * @member {number} [pausewaitforsyncdraintimeperiodinseconds] Pre Restore + * @member {number} [pauseWaitForSyncDrainTimePeriodInSeconds] Pre Restore * pause wait for sync drain time period in seconds. */ constructor() { @@ -113,9 +113,9 @@ class PreRestoreRequest { } } }, - pausewaitforsyncdraintimeperiodinseconds: { + pauseWaitForSyncDrainTimePeriodInSeconds: { required: false, - serializedName: 'pausewaitforsyncdraintimeperiodinseconds', + serializedName: 'pauseWaitForSyncDrainTimePeriodInSeconds', type: { name: 'Number' } diff --git a/lib/services/storagesyncManagement/lib/models/restoreFileSpec.js b/lib/services/storagesyncManagement/lib/models/restoreFileSpec.js index f791076a15..1f6eb235f7 100644 --- a/lib/services/storagesyncManagement/lib/models/restoreFileSpec.js +++ b/lib/services/storagesyncManagement/lib/models/restoreFileSpec.js @@ -46,6 +46,7 @@ class RestoreFileSpec { }, isdir: { required: false, + readOnly: true, serializedName: 'isdir', type: { name: 'Boolean' diff --git a/lib/services/storagesyncManagement/lib/models/storageSyncError.js b/lib/services/storagesyncManagement/lib/models/storageSyncError.js new file mode 100644 index 0000000000..509d940f23 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/storageSyncError.js @@ -0,0 +1,74 @@ +/* + * 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'); + +/** + * Error type + * + */ +class StorageSyncError { + /** + * Create a StorageSyncError. + * @member {string} [code] Error code of the given entry. + * @member {string} [message] Error message of the given entry. + * @member {object} [details] Error details of the given entry. + * @member {string} [details.code] Error code of the given entry. + * @member {string} [details.message] Error message of the given entry. + * @member {string} [details.target] Target of the given entry. + */ + constructor() { + } + + /** + * Defines the metadata of StorageSyncError + * + * @returns {object} metadata of StorageSyncError + * + */ + mapper() { + return { + required: false, + serializedName: 'StorageSyncError', + type: { + name: 'Composite', + className: 'StorageSyncError', + modelProperties: { + code: { + required: false, + serializedName: 'code', + type: { + name: 'String' + } + }, + message: { + required: false, + serializedName: 'message', + type: { + name: 'String' + } + }, + details: { + required: false, + serializedName: 'details', + type: { + name: 'Composite', + className: 'StorageSyncErrorDetails' + } + } + } + } + }; + } +} + +module.exports = StorageSyncError; diff --git a/lib/services/storagesyncManagement/lib/models/storageSyncErrorDetails.js b/lib/services/storagesyncManagement/lib/models/storageSyncErrorDetails.js new file mode 100644 index 0000000000..d8fe07560a --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/storageSyncErrorDetails.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Error Details object. + * + */ +class StorageSyncErrorDetails { + /** + * Create a StorageSyncErrorDetails. + * @member {string} [code] Error code of the given entry. + * @member {string} [message] Error message of the given entry. + * @member {string} [target] Target of the given entry. + */ + constructor() { + } + + /** + * Defines the metadata of StorageSyncErrorDetails + * + * @returns {object} metadata of StorageSyncErrorDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'StorageSyncErrorDetails', + type: { + name: 'Composite', + className: 'StorageSyncErrorDetails', + modelProperties: { + code: { + required: false, + serializedName: 'code', + type: { + name: 'String' + } + }, + message: { + required: false, + serializedName: 'message', + type: { + name: 'String' + } + }, + target: { + required: false, + serializedName: 'target', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = StorageSyncErrorDetails; diff --git a/lib/services/storagesyncManagement/lib/models/subscriptionState.js b/lib/services/storagesyncManagement/lib/models/subscriptionState.js index 43bd80ec08..cf77bf1f05 100644 --- a/lib/services/storagesyncManagement/lib/models/subscriptionState.js +++ b/lib/services/storagesyncManagement/lib/models/subscriptionState.js @@ -48,6 +48,7 @@ class SubscriptionState { }, istransitioning: { required: false, + readOnly: true, serializedName: 'istransitioning', type: { name: 'Boolean' diff --git a/lib/services/storagesyncManagement/lib/operations/cloudEndpoints.js b/lib/services/storagesyncManagement/lib/operations/cloudEndpoints.js index 0e2a984c9f..e6ce9ccc6c 100644 --- a/lib/services/storagesyncManagement/lib/operations/cloudEndpoints.js +++ b/lib/services/storagesyncManagement/lib/operations/cloudEndpoints.js @@ -44,8 +44,6 @@ const WebResource = msRest.WebResource; * * @param {string} [body.friendlyName] Friendly Name * - * @param {boolean} [body.backupEnabled] Backup Enabled - * * @param {string} [body.provisioningState] CloudEndpoint Provisioning State * * @param {string} [body.lastWorkflowId] CloudEndpoint lastWorkflowId @@ -259,7 +257,7 @@ function _get(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEnd error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['ErrorModel']().mapper(); + let resultMapper = new client.models['StorageSyncError']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -364,7 +362,7 @@ function _deleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, } /** - * Create a new CloudEndpoint. + * Get a CloudEndpoint List. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -374,30 +372,6 @@ function _deleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, * * @param {string} syncGroupName Name of Sync Group resource. * - * @param {string} cloudEndpointName Name of Cloud Endpoint object. - * - * @param {object} body Body of Cloud Endpoint resource. - * - * @param {string} [body.storageAccountKey] Storage Account access key. - * - * @param {string} [body.storageAccount] Storage Account name. - * - * @param {string} [body.storageAccountResourceId] Storage Account Resource Id - * - * @param {string} [body.storageAccountShareName] Storage Account Share name - * - * @param {string} [body.storageAccountTenantId] Storage Account Tenant Id - * - * @param {string} [body.partnershipId] Partnership Id - * - * @param {string} [body.friendlyName] Friendly Name - * - * @param {boolean} [body.backupEnabled] Backup Enabled - * - * @param {string} [body.provisioningState] CloudEndpoint Provisioning State - * - * @param {string} [body.lastWorkflowId] CloudEndpoint lastWorkflowId - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -410,13 +384,13 @@ function _deleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, * {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 CloudEndpoint} for more information. + * See {@link CloudEndpointArray} 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, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, callback) { +function _listBySyncGroup(resourceGroupName, storageSyncServiceName, syncGroupName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -457,12 +431,6 @@ function _beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, if (syncGroupName === null || syncGroupName === undefined || typeof syncGroupName.valueOf() !== 'string') { throw new Error('syncGroupName cannot be null or undefined and it must be of type string.'); } - if (cloudEndpointName === null || cloudEndpointName === undefined || typeof cloudEndpointName.valueOf() !== 'string') { - throw new Error('cloudEndpointName cannot be null or undefined and it must be of type string.'); - } - if (body === null || body === undefined) { - throw new Error('body 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.'); } @@ -472,12 +440,11 @@ function _beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints'; requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); requestUrl = requestUrl.replace('{syncGroupName}', encodeURIComponent(syncGroupName)); - requestUrl = requestUrl.replace('{cloudEndpointName}', encodeURIComponent(cloudEndpointName)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { @@ -486,7 +453,7 @@ function _beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, // Create HTTP transport objects let httpRequest = new WebResource(); - httpRequest.method = 'PUT'; + httpRequest.method = 'GET'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers @@ -504,28 +471,14 @@ function _beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, } } } - // Serialize Request - let requestContent = null; - let requestModel = null; - try { - if (body !== null && body !== undefined) { - let requestModelMapper = new client.models['CloudEndpoint']().mapper(); - requestModel = client.serialize(requestModelMapper, body, 'body'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(body, null, 2)}.`); - return callback(serializationError); - } - httpRequest.body = requestContent; + 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) { + if (statusCode !== 200) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -541,7 +494,7 @@ function _beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['ErrorModel']().mapper(); + let resultMapper = new client.models['StorageSyncError']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -561,7 +514,7 @@ function _beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['CloudEndpoint']().mapper(); + let resultMapper = new client.models['CloudEndpointArray']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -576,8 +529,9 @@ function _beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, }); } + /** - * Delete a given CloudEndpoint. + * Pre Backup a given CloudEndpoint. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -589,6 +543,10 @@ function _beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -606,165 +564,2651 @@ function _beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _beginDeleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, callback) { +function _preBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { - if (resourceGroupName.length > 90) - { - throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); - } - if (resourceGroupName.length < 1) - { - throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); - } - if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) - { - throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); - } - } - 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { - throw new Error('storageSyncServiceName cannot be null or undefined and it must be of type string.'); - } - if (syncGroupName === null || syncGroupName === undefined || typeof syncGroupName.valueOf() !== 'string') { - throw new Error('syncGroupName cannot be null or undefined and it must be of type string.'); - } - if (cloudEndpointName === null || cloudEndpointName === undefined || typeof cloudEndpointName.valueOf() !== 'string') { - throw new Error('cloudEndpointName 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.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); - requestUrl = requestUrl.replace('{syncGroupName}', encodeURIComponent(syncGroupName)); - requestUrl = requestUrl.replace('{cloudEndpointName}', encodeURIComponent(cloudEndpointName)); - let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); - if (queryParameters.length > 0) { - requestUrl += '?' + queryParameters.join('&'); - } + // Send request + this.beginPreBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); - // 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 && statusCode !== 204) { - let error = new Error(responseBody); - error.statusCode = response.statusCode; - error.request = msRest.stripRequest(httpRequest); - error.response = msRest.stripResponse(response); + 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; - 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['ErrorModel']().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); + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); }); } -/** Class representing a CloudEndpoints. */ -class CloudEndpoints { - /** - * Create a CloudEndpoints. - * @param {MicrosoftStorageSync} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._create = _create; - this._get = _get; - this._deleteMethod = _deleteMethod; - this._beginCreate = _beginCreate; - this._beginDeleteMethod = _beginDeleteMethod; + +/** + * Post Backup a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * + * @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 PostBackupResponse} 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 _postBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; } - /** - * Create a new CloudEndpoint. - * - * @param {string} resourceGroupName The name of the resource group within the - * user's subscription. The name is case insensitive. - * - * @param {string} storageSyncServiceName Name of Storage Sync Service - * resource. - * - * @param {string} syncGroupName Name of Sync Group resource. - * - * @param {string} cloudEndpointName Name of Cloud Endpoint object. - * - * @param {object} body Body of Cloud Endpoint resource. - * - * @param {string} [body.storageAccountKey] Storage Account access key. - * - * @param {string} [body.storageAccount] Storage Account name. + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginPostBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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['PostBackupResponse']().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); + }); + }); +} + + +/** + * Pre Restore a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint object. + * + * @param {string} [body.partition] Pre Restore partition. + * + * @param {string} [body.replicaGroup] Pre Restore replica group. + * + * @param {string} [body.requestId] Pre Restore request id. + * + * @param {string} [body.azureFileShareUri] Pre Restore Azure file share uri. + * + * @param {string} [body.status] Pre Restore Azure status. + * + * @param {string} [body.sourceAzureFileShareUri] Pre Restore Azure source + * azure file share uri. + * + * @param {string} [body.backupMetadataPropertyBag] Pre Restore backup metadata + * property bag. + * + * @param {array} [body.restoreFileSpec] Pre Restore restore file spec array. + * + * @param {number} [body.pauseWaitForSyncDrainTimePeriodInSeconds] Pre Restore + * pause wait for sync drain time period in seconds. + * + * @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 _preRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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.beginPreRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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); + }); + }); +} + +/** + * Restore Heartbeat a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @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 _restoreHeatbeat(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName cannot be null or undefined and it must be of type string.'); + } + if (syncGroupName === null || syncGroupName === undefined || typeof syncGroupName.valueOf() !== 'string') { + throw new Error('syncGroupName cannot be null or undefined and it must be of type string.'); + } + if (cloudEndpointName === null || cloudEndpointName === undefined || typeof cloudEndpointName.valueOf() !== 'string') { + throw new Error('cloudEndpointName 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.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/restoreheartbeat'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + requestUrl = requestUrl.replace('{syncGroupName}', encodeURIComponent(syncGroupName)); + requestUrl = requestUrl.replace('{cloudEndpointName}', encodeURIComponent(cloudEndpointName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['StorageSyncError']().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); + }); +} + + +/** + * Post Restore a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint object. + * + * @param {string} [body.partition] Post Restore partition. + * + * @param {string} [body.replicaGroup] Post Restore replica group. + * + * @param {string} [body.requestId] Post Restore request id. + * + * @param {string} [body.azureFileShareUri] Post Restore Azure file share uri. + * + * @param {string} [body.status] Post Restore Azure status. + * + * @param {string} [body.sourceAzureFileShareUri] Post Restore Azure source + * azure file share uri. + * + * @param {string} [body.failedFileList] Post Restore Azure failed file list. + * + * @param {array} [body.restoreFileSpec] Post Restore restore file spec array. + * + * @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 _postRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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.beginPostRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Create a new CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint resource. + * + * @param {string} [body.storageAccountKey] Storage Account access key. + * + * @param {string} [body.storageAccount] Storage Account name. + * + * @param {string} [body.storageAccountResourceId] Storage Account Resource Id + * + * @param {string} [body.storageAccountShareName] Storage Account Share name + * + * @param {string} [body.storageAccountTenantId] Storage Account Tenant Id + * + * @param {string} [body.partnershipId] Partnership Id + * + * @param {string} [body.friendlyName] Friendly Name + * + * @param {string} [body.provisioningState] CloudEndpoint Provisioning State + * + * @param {string} [body.lastWorkflowId] CloudEndpoint lastWorkflowId + * + * @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 CloudEndpoint} 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, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName cannot be null or undefined and it must be of type string.'); + } + if (syncGroupName === null || syncGroupName === undefined || typeof syncGroupName.valueOf() !== 'string') { + throw new Error('syncGroupName cannot be null or undefined and it must be of type string.'); + } + if (cloudEndpointName === null || cloudEndpointName === undefined || typeof cloudEndpointName.valueOf() !== 'string') { + throw new Error('cloudEndpointName cannot be null or undefined and it must be of type string.'); + } + if (body === null || body === undefined) { + throw new Error('body 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.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + requestUrl = requestUrl.replace('{syncGroupName}', encodeURIComponent(syncGroupName)); + requestUrl = requestUrl.replace('{cloudEndpointName}', encodeURIComponent(cloudEndpointName)); + 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 (body !== null && body !== undefined) { + let requestModelMapper = new client.models['CloudEndpoint']().mapper(); + requestModel = client.serialize(requestModelMapper, body, 'body'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(body, 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['StorageSyncError']().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['CloudEndpoint']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Delete a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @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, storageSyncServiceName, syncGroupName, cloudEndpointName, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName cannot be null or undefined and it must be of type string.'); + } + if (syncGroupName === null || syncGroupName === undefined || typeof syncGroupName.valueOf() !== 'string') { + throw new Error('syncGroupName cannot be null or undefined and it must be of type string.'); + } + if (cloudEndpointName === null || cloudEndpointName === undefined || typeof cloudEndpointName.valueOf() !== 'string') { + throw new Error('cloudEndpointName 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.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + requestUrl = requestUrl.replace('{syncGroupName}', encodeURIComponent(syncGroupName)); + requestUrl = requestUrl.replace('{cloudEndpointName}', encodeURIComponent(cloudEndpointName)); + 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 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['StorageSyncError']().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); + }); +} + +/** + * Pre Backup a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * + * @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 _beginPreBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName cannot be null or undefined and it must be of type string.'); + } + if (syncGroupName === null || syncGroupName === undefined || typeof syncGroupName.valueOf() !== 'string') { + throw new Error('syncGroupName cannot be null or undefined and it must be of type string.'); + } + if (cloudEndpointName === null || cloudEndpointName === undefined || typeof cloudEndpointName.valueOf() !== 'string') { + throw new Error('cloudEndpointName cannot be null or undefined and it must be of type string.'); + } + if (body === null || body === undefined) { + throw new Error('body 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.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prebackup'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + requestUrl = requestUrl.replace('{syncGroupName}', encodeURIComponent(syncGroupName)); + requestUrl = requestUrl.replace('{cloudEndpointName}', encodeURIComponent(cloudEndpointName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (body !== null && body !== undefined) { + let requestModelMapper = new client.models['BackupRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, body, 'body'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(body, 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['StorageSyncError']().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); + }); +} + +/** + * Post Backup a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * + * @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 PostBackupResponse} 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 _beginPostBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName cannot be null or undefined and it must be of type string.'); + } + if (syncGroupName === null || syncGroupName === undefined || typeof syncGroupName.valueOf() !== 'string') { + throw new Error('syncGroupName cannot be null or undefined and it must be of type string.'); + } + if (cloudEndpointName === null || cloudEndpointName === undefined || typeof cloudEndpointName.valueOf() !== 'string') { + throw new Error('cloudEndpointName cannot be null or undefined and it must be of type string.'); + } + if (body === null || body === undefined) { + throw new Error('body 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.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postbackup'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + requestUrl = requestUrl.replace('{syncGroupName}', encodeURIComponent(syncGroupName)); + requestUrl = requestUrl.replace('{cloudEndpointName}', encodeURIComponent(cloudEndpointName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (body !== null && body !== undefined) { + let requestModelMapper = new client.models['BackupRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, body, 'body'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(body, 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['StorageSyncError']().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['PostBackupResponse']().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); + }); +} + +/** + * Pre Restore a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint object. + * + * @param {string} [body.partition] Pre Restore partition. + * + * @param {string} [body.replicaGroup] Pre Restore replica group. + * + * @param {string} [body.requestId] Pre Restore request id. + * + * @param {string} [body.azureFileShareUri] Pre Restore Azure file share uri. + * + * @param {string} [body.status] Pre Restore Azure status. + * + * @param {string} [body.sourceAzureFileShareUri] Pre Restore Azure source + * azure file share uri. + * + * @param {string} [body.backupMetadataPropertyBag] Pre Restore backup metadata + * property bag. + * + * @param {array} [body.restoreFileSpec] Pre Restore restore file spec array. + * + * @param {number} [body.pauseWaitForSyncDrainTimePeriodInSeconds] Pre Restore + * pause wait for sync drain time period in seconds. + * + * @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 _beginPreRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName cannot be null or undefined and it must be of type string.'); + } + if (syncGroupName === null || syncGroupName === undefined || typeof syncGroupName.valueOf() !== 'string') { + throw new Error('syncGroupName cannot be null or undefined and it must be of type string.'); + } + if (cloudEndpointName === null || cloudEndpointName === undefined || typeof cloudEndpointName.valueOf() !== 'string') { + throw new Error('cloudEndpointName cannot be null or undefined and it must be of type string.'); + } + if (body === null || body === undefined) { + throw new Error('body 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.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prerestore'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + requestUrl = requestUrl.replace('{syncGroupName}', encodeURIComponent(syncGroupName)); + requestUrl = requestUrl.replace('{cloudEndpointName}', encodeURIComponent(cloudEndpointName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (body !== null && body !== undefined) { + let requestModelMapper = new client.models['PreRestoreRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, body, 'body'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(body, 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['StorageSyncError']().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); + }); +} + +/** + * Post Restore a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint object. + * + * @param {string} [body.partition] Post Restore partition. + * + * @param {string} [body.replicaGroup] Post Restore replica group. + * + * @param {string} [body.requestId] Post Restore request id. + * + * @param {string} [body.azureFileShareUri] Post Restore Azure file share uri. + * + * @param {string} [body.status] Post Restore Azure status. + * + * @param {string} [body.sourceAzureFileShareUri] Post Restore Azure source + * azure file share uri. + * + * @param {string} [body.failedFileList] Post Restore Azure failed file list. + * + * @param {array} [body.restoreFileSpec] Post Restore restore file spec array. + * + * @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 _beginPostRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName cannot be null or undefined and it must be of type string.'); + } + if (syncGroupName === null || syncGroupName === undefined || typeof syncGroupName.valueOf() !== 'string') { + throw new Error('syncGroupName cannot be null or undefined and it must be of type string.'); + } + if (cloudEndpointName === null || cloudEndpointName === undefined || typeof cloudEndpointName.valueOf() !== 'string') { + throw new Error('cloudEndpointName cannot be null or undefined and it must be of type string.'); + } + if (body === null || body === undefined) { + throw new Error('body 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.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postrestore'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + requestUrl = requestUrl.replace('{syncGroupName}', encodeURIComponent(syncGroupName)); + requestUrl = requestUrl.replace('{cloudEndpointName}', encodeURIComponent(cloudEndpointName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (body !== null && body !== undefined) { + let requestModelMapper = new client.models['PostRestoreRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, body, 'body'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(body, 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['StorageSyncError']().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 CloudEndpoints. */ +class CloudEndpoints { + /** + * Create a CloudEndpoints. + * @param {StorageSyncManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._create = _create; + this._get = _get; + this._deleteMethod = _deleteMethod; + this._listBySyncGroup = _listBySyncGroup; + this._preBackup = _preBackup; + this._postBackup = _postBackup; + this._preRestore = _preRestore; + this._restoreHeatbeat = _restoreHeatbeat; + this._postRestore = _postRestore; + this._beginCreate = _beginCreate; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginPreBackup = _beginPreBackup; + this._beginPostBackup = _beginPostBackup; + this._beginPreRestore = _beginPreRestore; + this._beginPostRestore = _beginPostRestore; + } + + /** + * Create a new CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint resource. + * + * @param {string} [body.storageAccountKey] Storage Account access key. + * + * @param {string} [body.storageAccount] Storage Account name. + * + * @param {string} [body.storageAccountResourceId] Storage Account Resource Id + * + * @param {string} [body.storageAccountShareName] Storage Account Share name + * + * @param {string} [body.storageAccountTenantId] Storage Account Tenant Id + * + * @param {string} [body.partnershipId] Partnership Id + * + * @param {string} [body.friendlyName] Friendly Name + * + * @param {string} [body.provisioningState] CloudEndpoint Provisioning State + * + * @param {string} [body.lastWorkflowId] CloudEndpoint lastWorkflowId + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._create(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create a new CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint resource. + * + * @param {string} [body.storageAccountKey] Storage Account access key. + * + * @param {string} [body.storageAccount] Storage Account name. + * + * @param {string} [body.storageAccountResourceId] Storage Account Resource Id + * + * @param {string} [body.storageAccountShareName] Storage Account Share name + * + * @param {string} [body.storageAccountTenantId] Storage Account Tenant Id + * + * @param {string} [body.partnershipId] Partnership Id + * + * @param {string} [body.friendlyName] Friendly Name + * + * @param {string} [body.provisioningState] CloudEndpoint Provisioning State + * + * @param {string} [body.lastWorkflowId] CloudEndpoint lastWorkflowId + * + * @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 {CloudEndpoint} - 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 CloudEndpoint} 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. + */ + create(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback); + } + } + + /** + * Get a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, storageSyncServiceName, syncGroupName, cloudEndpointName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @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 {CloudEndpoint} - 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 CloudEndpoint} 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, storageSyncServiceName, syncGroupName, cloudEndpointName, 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, storageSyncServiceName, syncGroupName, cloudEndpointName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, optionalCallback); + } + } + + /** + * Delete a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, storageSyncServiceName, syncGroupName, cloudEndpointName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @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, storageSyncServiceName, syncGroupName, cloudEndpointName, 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, storageSyncServiceName, syncGroupName, cloudEndpointName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, optionalCallback); + } + } + + /** + * Get a CloudEndpoint List. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listBySyncGroupWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listBySyncGroup(resourceGroupName, storageSyncServiceName, syncGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get a CloudEndpoint List. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {CloudEndpointArray} - 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 CloudEndpointArray} 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. + */ + listBySyncGroup(resourceGroupName, storageSyncServiceName, syncGroupName, 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._listBySyncGroup(resourceGroupName, storageSyncServiceName, syncGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listBySyncGroup(resourceGroupName, storageSyncServiceName, syncGroupName, options, optionalCallback); + } + } + + /** + * Pre Backup a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + preBackupWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._preBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Pre Backup a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * + * @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. + */ + preBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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._preBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._preBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback); + } + } + + /** + * Post Backup a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + postBackupWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._postBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Post Backup a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * + * @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 {PostBackupResponse} - 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 PostBackupResponse} 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. + */ + postBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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._postBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._postBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback); + } + } + + /** + * Pre Restore a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint object. + * + * @param {string} [body.partition] Pre Restore partition. + * + * @param {string} [body.replicaGroup] Pre Restore replica group. + * + * @param {string} [body.requestId] Pre Restore request id. + * + * @param {string} [body.azureFileShareUri] Pre Restore Azure file share uri. + * + * @param {string} [body.status] Pre Restore Azure status. + * + * @param {string} [body.sourceAzureFileShareUri] Pre Restore Azure source + * azure file share uri. + * + * @param {string} [body.backupMetadataPropertyBag] Pre Restore backup metadata + * property bag. + * + * @param {array} [body.restoreFileSpec] Pre Restore restore file spec array. + * + * @param {number} [body.pauseWaitForSyncDrainTimePeriodInSeconds] Pre Restore + * pause wait for sync drain time period in seconds. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + preRestoreWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._preRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Pre Restore a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint object. + * + * @param {string} [body.partition] Pre Restore partition. + * + * @param {string} [body.replicaGroup] Pre Restore replica group. + * + * @param {string} [body.requestId] Pre Restore request id. + * + * @param {string} [body.azureFileShareUri] Pre Restore Azure file share uri. + * + * @param {string} [body.status] Pre Restore Azure status. + * + * @param {string} [body.sourceAzureFileShareUri] Pre Restore Azure source + * azure file share uri. + * + * @param {string} [body.backupMetadataPropertyBag] Pre Restore backup metadata + * property bag. + * + * @param {array} [body.restoreFileSpec] Pre Restore restore file spec array. + * + * @param {number} [body.pauseWaitForSyncDrainTimePeriodInSeconds] Pre Restore + * pause wait for sync drain time period in seconds. + * + * @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. + */ + preRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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._preRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._preRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback); + } + } + + /** + * Restore Heartbeat a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + restoreHeatbeatWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._restoreHeatbeat(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Restore Heartbeat a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @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. + */ + restoreHeatbeat(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, 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._restoreHeatbeat(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._restoreHeatbeat(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, optionalCallback); + } + } + + /** + * Post Restore a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint object. + * + * @param {string} [body.partition] Post Restore partition. + * + * @param {string} [body.replicaGroup] Post Restore replica group. + * + * @param {string} [body.requestId] Post Restore request id. + * + * @param {string} [body.azureFileShareUri] Post Restore Azure file share uri. + * + * @param {string} [body.status] Post Restore Azure status. + * + * @param {string} [body.sourceAzureFileShareUri] Post Restore Azure source + * azure file share uri. + * + * @param {string} [body.failedFileList] Post Restore Azure failed file list. + * + * @param {array} [body.restoreFileSpec] Post Restore restore file spec array. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + postRestoreWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._postRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Post Restore a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint object. + * + * @param {string} [body.partition] Post Restore partition. + * + * @param {string} [body.replicaGroup] Post Restore replica group. + * + * @param {string} [body.requestId] Post Restore request id. + * + * @param {string} [body.azureFileShareUri] Post Restore Azure file share uri. + * + * @param {string} [body.status] Post Restore Azure status. + * + * @param {string} [body.sourceAzureFileShareUri] Post Restore Azure source + * azure file share uri. + * + * @param {string} [body.failedFileList] Post Restore Azure failed file list. + * + * @param {array} [body.restoreFileSpec] Post Restore restore file spec array. + * + * @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. + */ + postRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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._postRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._postRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback); + } + } + + /** + * Create a new CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint resource. + * + * @param {string} [body.storageAccountKey] Storage Account access key. + * + * @param {string} [body.storageAccount] Storage Account name. * * @param {string} [body.storageAccountResourceId] Storage Account Resource Id * @@ -776,8 +3220,6 @@ class CloudEndpoints { * * @param {string} [body.friendlyName] Friendly Name * - * @param {boolean} [body.backupEnabled] Backup Enabled - * * @param {string} [body.provisioningState] CloudEndpoint Provisioning State * * @param {string} [body.lastWorkflowId] CloudEndpoint lastWorkflowId @@ -793,11 +3235,11 @@ class CloudEndpoints { * * @reject {Error} - The error object. */ - createWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options) { + beginCreateWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._create(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + self._beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -836,8 +3278,6 @@ class CloudEndpoints { * * @param {string} [body.friendlyName] Friendly Name * - * @param {boolean} [body.backupEnabled] Backup Enabled - * * @param {string} [body.provisioningState] CloudEndpoint Provisioning State * * @param {string} [body.lastWorkflowId] CloudEndpoint lastWorkflowId @@ -869,7 +3309,7 @@ class CloudEndpoints { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - create(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback) { + beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -878,19 +3318,19 @@ class CloudEndpoints { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._create(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + self._beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._create(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback); + return self._beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback); } } /** - * Get a given CloudEndpoint. + * Delete a given CloudEndpoint. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -909,15 +3349,15 @@ class CloudEndpoints { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - getWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options) { + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._get(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, (err, result, request, response) => { + self._beginDeleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -928,7 +3368,7 @@ class CloudEndpoints { } /** - * Get a given CloudEndpoint. + * Delete a given CloudEndpoint. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -952,7 +3392,7 @@ class CloudEndpoints { * * {Promise} A promise is returned * - * @resolve {CloudEndpoint} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error} - The error object. * @@ -960,14 +3400,13 @@ class CloudEndpoints { * * {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 CloudEndpoint} for more information. + * {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. */ - get(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, optionalCallback) { + beginDeleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -976,19 +3415,19 @@ class CloudEndpoints { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._get(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, (err, result, request, response) => { + self._beginDeleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._get(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, optionalCallback); + return self._beginDeleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, optionalCallback); } } /** - * Delete a given CloudEndpoint. + * Pre Backup a given CloudEndpoint. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -1000,6 +3439,10 @@ class CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1011,11 +3454,11 @@ class CloudEndpoints { * * @reject {Error} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options) { + beginPreBackupWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._deleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, (err, result, request, response) => { + self._beginPreBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1026,7 +3469,7 @@ class CloudEndpoints { } /** - * Delete a given CloudEndpoint. + * Pre Backup a given CloudEndpoint. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -1038,6 +3481,10 @@ class CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1064,7 +3511,7 @@ class CloudEndpoints { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, optionalCallback) { + beginPreBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -1073,19 +3520,19 @@ class CloudEndpoints { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._deleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, (err, result, request, response) => { + self._beginPreBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._deleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, optionalCallback); + return self._beginPreBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback); } } /** - * Create a new CloudEndpoint. + * Post Backup a given CloudEndpoint. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -1097,27 +3544,134 @@ class CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Cloud Endpoint resource. + * @param {object} body Body of Backup request. * - * @param {string} [body.storageAccountKey] Storage Account access key. + * @param {string} [body.azureFileShare] Azure File Share. * - * @param {string} [body.storageAccount] Storage Account name. + * @param {object} [options] Optional Parameters. * - * @param {string} [body.storageAccountResourceId] Storage Account Resource Id + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {string} [body.storageAccountShareName] Storage Account Share name + * @returns {Promise} A promise is returned * - * @param {string} [body.storageAccountTenantId] Storage Account Tenant Id + * @resolve {HttpOperationResponse} - The deserialized result object. * - * @param {string} [body.partnershipId] Partnership Id + * @reject {Error} - The error object. + */ + beginPostBackupWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginPostBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Post Backup a given CloudEndpoint. * - * @param {string} [body.friendlyName] Friendly Name + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. * - * @param {boolean} [body.backupEnabled] Backup Enabled + * @param {string} syncGroupName Name of Sync Group resource. * - * @param {string} [body.provisioningState] CloudEndpoint Provisioning State + * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {string} [body.lastWorkflowId] CloudEndpoint lastWorkflowId + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * + * @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 {PostBackupResponse} - 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 PostBackupResponse} 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. + */ + beginPostBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, 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._beginPostBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginPostBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback); + } + } + + /** + * Pre Restore a given CloudEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Cloud Endpoint object. + * + * @param {string} [body.partition] Pre Restore partition. + * + * @param {string} [body.replicaGroup] Pre Restore replica group. + * + * @param {string} [body.requestId] Pre Restore request id. + * + * @param {string} [body.azureFileShareUri] Pre Restore Azure file share uri. + * + * @param {string} [body.status] Pre Restore Azure status. + * + * @param {string} [body.sourceAzureFileShareUri] Pre Restore Azure source + * azure file share uri. + * + * @param {string} [body.backupMetadataPropertyBag] Pre Restore backup metadata + * property bag. + * + * @param {array} [body.restoreFileSpec] Pre Restore restore file spec array. + * + * @param {number} [body.pauseWaitForSyncDrainTimePeriodInSeconds] Pre Restore + * pause wait for sync drain time period in seconds. * * @param {object} [options] Optional Parameters. * @@ -1126,15 +3680,15 @@ class CloudEndpoints { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - beginCreateWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options) { + beginPreRestoreWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + self._beginPreRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1145,7 +3699,7 @@ class CloudEndpoints { } /** - * Create a new CloudEndpoint. + * Pre Restore a given CloudEndpoint. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -1157,27 +3711,28 @@ class CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Cloud Endpoint resource. - * - * @param {string} [body.storageAccountKey] Storage Account access key. + * @param {object} body Body of Cloud Endpoint object. * - * @param {string} [body.storageAccount] Storage Account name. + * @param {string} [body.partition] Pre Restore partition. * - * @param {string} [body.storageAccountResourceId] Storage Account Resource Id + * @param {string} [body.replicaGroup] Pre Restore replica group. * - * @param {string} [body.storageAccountShareName] Storage Account Share name + * @param {string} [body.requestId] Pre Restore request id. * - * @param {string} [body.storageAccountTenantId] Storage Account Tenant Id + * @param {string} [body.azureFileShareUri] Pre Restore Azure file share uri. * - * @param {string} [body.partnershipId] Partnership Id + * @param {string} [body.status] Pre Restore Azure status. * - * @param {string} [body.friendlyName] Friendly Name + * @param {string} [body.sourceAzureFileShareUri] Pre Restore Azure source + * azure file share uri. * - * @param {boolean} [body.backupEnabled] Backup Enabled + * @param {string} [body.backupMetadataPropertyBag] Pre Restore backup metadata + * property bag. * - * @param {string} [body.provisioningState] CloudEndpoint Provisioning State + * @param {array} [body.restoreFileSpec] Pre Restore restore file spec array. * - * @param {string} [body.lastWorkflowId] CloudEndpoint lastWorkflowId + * @param {number} [body.pauseWaitForSyncDrainTimePeriodInSeconds] Pre Restore + * pause wait for sync drain time period in seconds. * * @param {object} [options] Optional Parameters. * @@ -1191,7 +3746,7 @@ class CloudEndpoints { * * {Promise} A promise is returned * - * @resolve {CloudEndpoint} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error} - The error object. * @@ -1199,14 +3754,13 @@ class CloudEndpoints { * * {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 CloudEndpoint} for more information. + * {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, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback) { + beginPreRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -1215,19 +3769,19 @@ class CloudEndpoints { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + self._beginPreRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback); + return self._beginPreRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback); } } /** - * Delete a given CloudEndpoint. + * Post Restore a given CloudEndpoint. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -1239,6 +3793,25 @@ class CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * + * @param {object} body Body of Cloud Endpoint object. + * + * @param {string} [body.partition] Post Restore partition. + * + * @param {string} [body.replicaGroup] Post Restore replica group. + * + * @param {string} [body.requestId] Post Restore request id. + * + * @param {string} [body.azureFileShareUri] Post Restore Azure file share uri. + * + * @param {string} [body.status] Post Restore Azure status. + * + * @param {string} [body.sourceAzureFileShareUri] Post Restore Azure source + * azure file share uri. + * + * @param {string} [body.failedFileList] Post Restore Azure failed file list. + * + * @param {array} [body.restoreFileSpec] Post Restore restore file spec array. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1250,11 +3823,11 @@ class CloudEndpoints { * * @reject {Error} - The error object. */ - beginDeleteMethodWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options) { + beginPostRestoreWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._beginDeleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, (err, result, request, response) => { + self._beginPostRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1265,7 +3838,7 @@ class CloudEndpoints { } /** - * Delete a given CloudEndpoint. + * Post Restore a given CloudEndpoint. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -1277,6 +3850,25 @@ class CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * + * @param {object} body Body of Cloud Endpoint object. + * + * @param {string} [body.partition] Post Restore partition. + * + * @param {string} [body.replicaGroup] Post Restore replica group. + * + * @param {string} [body.requestId] Post Restore request id. + * + * @param {string} [body.azureFileShareUri] Post Restore Azure file share uri. + * + * @param {string} [body.status] Post Restore Azure status. + * + * @param {string} [body.sourceAzureFileShareUri] Post Restore Azure source + * azure file share uri. + * + * @param {string} [body.failedFileList] Post Restore Azure failed file list. + * + * @param {array} [body.restoreFileSpec] Post Restore restore file spec array. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1303,7 +3895,7 @@ class CloudEndpoints { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - beginDeleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, optionalCallback) { + beginPostRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -1312,14 +3904,14 @@ class CloudEndpoints { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._beginDeleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, (err, result, request, response) => { + self._beginPostRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._beginDeleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, optionalCallback); + return self._beginPostRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback); } } diff --git a/lib/services/storagesyncManagement/lib/operations/index.d.ts b/lib/services/storagesyncManagement/lib/operations/index.d.ts index 5014843048..e9b56781b8 100644 --- a/lib/services/storagesyncManagement/lib/operations/index.d.ts +++ b/lib/services/storagesyncManagement/lib/operations/index.d.ts @@ -14,11 +14,11 @@ import * as models from '../models'; /** * @class - * OperationGet + * Operations * __NOTE__: An instance of this class is automatically created for an - * instance of the MicrosoftStorageSync. + * instance of the StorageSyncManagementClient. */ -export interface OperationGet { +export interface Operations { /** @@ -135,7 +135,7 @@ export interface OperationGet { * @class * StorageSyncServices * __NOTE__: An instance of this class is automatically created for an - * instance of the MicrosoftStorageSync. + * instance of the StorageSyncManagementClient. */ export interface StorageSyncServices { @@ -397,15 +397,6 @@ export interface StorageSyncServices { deleteMethod(resourceGroupName: string, storageSyncServiceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; deleteMethod(resourceGroupName: string, storageSyncServiceName: string, callback: ServiceCallback): void; deleteMethod(resourceGroupName: string, storageSyncServiceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * StorageSyncServiceByResourceGroupGet - * __NOTE__: An instance of this class is automatically created for an - * instance of the MicrosoftStorageSync. - */ -export interface StorageSyncServiceByResourceGroupGet { /** @@ -425,7 +416,7 @@ export interface StorageSyncServiceByResourceGroupGet { * * @reject {Error|ServiceError} - The error object. */ - listWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Get a StorageSyncService list by Resource group name. @@ -461,18 +452,9 @@ export interface StorageSyncServiceByResourceGroupGet { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - list(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - list(resourceGroupName: string, callback: ServiceCallback): void; - list(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * StorageSyncServiceGet - * __NOTE__: An instance of this class is automatically created for an - * instance of the MicrosoftStorageSync. - */ -export interface StorageSyncServiceGet { + listByResourceGroup(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -529,11 +511,11 @@ export interface StorageSyncServiceGet { /** * @class - * GetSyncGroups + * SyncGroups * __NOTE__: An instance of this class is automatically created for an - * instance of the MicrosoftStorageSync. + * instance of the StorageSyncManagementClient. */ -export interface GetSyncGroups { +export interface SyncGroups { /** @@ -597,15 +579,6 @@ export interface GetSyncGroups { listByStorageSyncService(resourceGroupName: string, storageSyncServiceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; listByStorageSyncService(resourceGroupName: string, storageSyncServiceName: string, callback: ServiceCallback): void; listByStorageSyncService(resourceGroupName: string, storageSyncServiceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * SyncGroups - * __NOTE__: An instance of this class is automatically created for an - * instance of the MicrosoftStorageSync. - */ -export interface SyncGroups { /** @@ -820,7 +793,7 @@ export interface SyncGroups { * @class * CloudEndpoints * __NOTE__: An instance of this class is automatically created for an - * instance of the MicrosoftStorageSync. + * instance of the StorageSyncManagementClient. */ export interface CloudEndpoints { @@ -854,8 +827,6 @@ export interface CloudEndpoints { * * @param {string} [body.friendlyName] Friendly Name * - * @param {boolean} [body.backupEnabled] Backup Enabled - * * @param {string} [body.provisioningState] CloudEndpoint Provisioning State * * @param {string} [body.lastWorkflowId] CloudEndpoint lastWorkflowId @@ -902,8 +873,6 @@ export interface CloudEndpoints { * * @param {string} [body.friendlyName] Friendly Name * - * @param {boolean} [body.backupEnabled] Backup Enabled - * * @param {string} [body.provisioningState] CloudEndpoint Provisioning State * * @param {string} [body.lastWorkflowId] CloudEndpoint lastWorkflowId @@ -1082,7 +1051,7 @@ export interface CloudEndpoints { /** - * Create a new CloudEndpoint. + * Get a CloudEndpoint List. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -1092,30 +1061,6 @@ export interface CloudEndpoints { * * @param {string} syncGroupName Name of Sync Group resource. * - * @param {string} cloudEndpointName Name of Cloud Endpoint object. - * - * @param {object} body Body of Cloud Endpoint resource. - * - * @param {string} [body.storageAccountKey] Storage Account access key. - * - * @param {string} [body.storageAccount] Storage Account name. - * - * @param {string} [body.storageAccountResourceId] Storage Account Resource Id - * - * @param {string} [body.storageAccountShareName] Storage Account Share name - * - * @param {string} [body.storageAccountTenantId] Storage Account Tenant Id - * - * @param {string} [body.partnershipId] Partnership Id - * - * @param {string} [body.friendlyName] Friendly Name - * - * @param {boolean} [body.backupEnabled] Backup Enabled - * - * @param {string} [body.provisioningState] CloudEndpoint Provisioning State - * - * @param {string} [body.lastWorkflowId] CloudEndpoint lastWorkflowId - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1123,14 +1068,14 @@ export interface CloudEndpoints { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginCreateWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.CloudEndpoint, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listBySyncGroupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Create a new CloudEndpoint. + * Get a CloudEndpoint List. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -1140,30 +1085,6 @@ export interface CloudEndpoints { * * @param {string} syncGroupName Name of Sync Group resource. * - * @param {string} cloudEndpointName Name of Cloud Endpoint object. - * - * @param {object} body Body of Cloud Endpoint resource. - * - * @param {string} [body.storageAccountKey] Storage Account access key. - * - * @param {string} [body.storageAccount] Storage Account name. - * - * @param {string} [body.storageAccountResourceId] Storage Account Resource Id - * - * @param {string} [body.storageAccountShareName] Storage Account Share name - * - * @param {string} [body.storageAccountTenantId] Storage Account Tenant Id - * - * @param {string} [body.partnershipId] Partnership Id - * - * @param {string} [body.friendlyName] Friendly Name - * - * @param {boolean} [body.backupEnabled] Backup Enabled - * - * @param {string} [body.provisioningState] CloudEndpoint Provisioning State - * - * @param {string} [body.lastWorkflowId] CloudEndpoint lastWorkflowId - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1176,7 +1097,7 @@ export interface CloudEndpoints { * * {Promise} A promise is returned. * - * @resolve {CloudEndpoint} - The deserialized result object. + * @resolve {CloudEndpointArray} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1184,20 +1105,20 @@ export interface CloudEndpoints { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {CloudEndpoint} [result] - The deserialized result object if an error did not occur. - * See {@link CloudEndpoint} for more information. + * {CloudEndpointArray} [result] - The deserialized result object if an error did not occur. + * See {@link CloudEndpointArray} 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, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.CloudEndpoint, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginCreate(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.CloudEndpoint, callback: ServiceCallback): void; - beginCreate(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.CloudEndpoint, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listBySyncGroup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBySyncGroup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, callback: ServiceCallback): void; + listBySyncGroup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Delete a given CloudEndpoint. + * Pre Backup a given CloudEndpoint. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -1209,6 +1130,10 @@ export interface CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1220,10 +1145,10 @@ export interface CloudEndpoints { * * @reject {Error|ServiceError} - The error object. */ - beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + preBackupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Delete a given CloudEndpoint. + * Pre Backup a given CloudEndpoint. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -1235,6 +1160,10 @@ export interface CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1261,22 +1190,13 @@ export interface CloudEndpoints { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginDeleteMethod(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginDeleteMethod(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, callback: ServiceCallback): void; - beginDeleteMethod(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * CloudEndpointsGet - * __NOTE__: An instance of this class is automatically created for an - * instance of the MicrosoftStorageSync. - */ -export interface CloudEndpointsGet { + preBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + preBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, callback: ServiceCallback): void; + preBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Get a CloudEndpoint List. + * Post Backup a given CloudEndpoint. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -1286,6 +1206,12 @@ export interface CloudEndpointsGet { * * @param {string} syncGroupName Name of Sync Group resource. * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1293,14 +1219,14 @@ export interface CloudEndpointsGet { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listBySyncGroupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + postBackupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Get a CloudEndpoint List. + * Post Backup a given CloudEndpoint. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -1310,6 +1236,12 @@ export interface CloudEndpointsGet { * * @param {string} syncGroupName Name of Sync Group resource. * + * @param {string} cloudEndpointName Name of Cloud Endpoint object. + * + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1322,7 +1254,7 @@ export interface CloudEndpointsGet { * * {Promise} A promise is returned. * - * @resolve {CloudEndpointArray} - The deserialized result object. + * @resolve {PostBackupResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1330,29 +1262,20 @@ export interface CloudEndpointsGet { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {CloudEndpointArray} [result] - The deserialized result object if an error did not occur. - * See {@link CloudEndpointArray} for more information. + * {PostBackupResponse} [result] - The deserialized result object if an error did not occur. + * See {@link PostBackupResponse} 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. */ - listBySyncGroup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listBySyncGroup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, callback: ServiceCallback): void; - listBySyncGroup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * CloudEndpointPreBackup - * __NOTE__: An instance of this class is automatically created for an - * instance of the MicrosoftStorageSync. - */ -export interface CloudEndpointPreBackup { + postBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + postBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, callback: ServiceCallback): void; + postBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Pre Backup a given CloudEndpoint. + * Pre Restore a given CloudEndpoint. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -1364,9 +1287,28 @@ export interface CloudEndpointPreBackup { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Backup request. + * @param {object} body Body of Cloud Endpoint object. * - * @param {string} [body.azureFileShare] Azure File Share. + * @param {string} [body.partition] Pre Restore partition. + * + * @param {string} [body.replicaGroup] Pre Restore replica group. + * + * @param {string} [body.requestId] Pre Restore request id. + * + * @param {string} [body.azureFileShareUri] Pre Restore Azure file share uri. + * + * @param {string} [body.status] Pre Restore Azure status. + * + * @param {string} [body.sourceAzureFileShareUri] Pre Restore Azure source + * azure file share uri. + * + * @param {string} [body.backupMetadataPropertyBag] Pre Restore backup metadata + * property bag. + * + * @param {array} [body.restoreFileSpec] Pre Restore restore file spec array. + * + * @param {number} [body.pauseWaitForSyncDrainTimePeriodInSeconds] Pre Restore + * pause wait for sync drain time period in seconds. * * @param {object} [options] Optional Parameters. * @@ -1379,10 +1321,10 @@ export interface CloudEndpointPreBackup { * * @reject {Error|ServiceError} - The error object. */ - postWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + preRestoreWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PreRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Pre Backup a given CloudEndpoint. + * Pre Restore a given CloudEndpoint. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -1394,9 +1336,28 @@ export interface CloudEndpointPreBackup { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Backup request. + * @param {object} body Body of Cloud Endpoint object. * - * @param {string} [body.azureFileShare] Azure File Share. + * @param {string} [body.partition] Pre Restore partition. + * + * @param {string} [body.replicaGroup] Pre Restore replica group. + * + * @param {string} [body.requestId] Pre Restore request id. + * + * @param {string} [body.azureFileShareUri] Pre Restore Azure file share uri. + * + * @param {string} [body.status] Pre Restore Azure status. + * + * @param {string} [body.sourceAzureFileShareUri] Pre Restore Azure source + * azure file share uri. + * + * @param {string} [body.backupMetadataPropertyBag] Pre Restore backup metadata + * property bag. + * + * @param {array} [body.restoreFileSpec] Pre Restore restore file spec array. + * + * @param {number} [body.pauseWaitForSyncDrainTimePeriodInSeconds] Pre Restore + * pause wait for sync drain time period in seconds. * * @param {object} [options] Optional Parameters. * @@ -1424,13 +1385,13 @@ export interface CloudEndpointPreBackup { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - post(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - post(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, callback: ServiceCallback): void; - post(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + preRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PreRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + preRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PreRestoreRequest, callback: ServiceCallback): void; + preRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PreRestoreRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Pre Backup a given CloudEndpoint. + * Restore Heartbeat a given CloudEndpoint. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -1442,10 +1403,6 @@ export interface CloudEndpointPreBackup { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Backup request. - * - * @param {string} [body.azureFileShare] Azure File Share. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1457,10 +1414,10 @@ export interface CloudEndpointPreBackup { * * @reject {Error|ServiceError} - The error object. */ - beginPostWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + restoreHeatbeatWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Pre Backup a given CloudEndpoint. + * Restore Heartbeat a given CloudEndpoint. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -1472,10 +1429,6 @@ export interface CloudEndpointPreBackup { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Backup request. - * - * @param {string} [body.azureFileShare] Azure File Share. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1502,22 +1455,13 @@ export interface CloudEndpointPreBackup { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginPost(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginPost(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, callback: ServiceCallback): void; - beginPost(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * CloudEndpointPostBackup - * __NOTE__: An instance of this class is automatically created for an - * instance of the MicrosoftStorageSync. - */ -export interface CloudEndpointPostBackup { + restoreHeatbeat(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + restoreHeatbeat(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, callback: ServiceCallback): void; + restoreHeatbeat(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Post Backup a given CloudEndpoint. + * Post Restore a given CloudEndpoint. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -1529,9 +1473,24 @@ export interface CloudEndpointPostBackup { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Backup request. + * @param {object} body Body of Cloud Endpoint object. * - * @param {string} [body.azureFileShare] Azure File Share. + * @param {string} [body.partition] Post Restore partition. + * + * @param {string} [body.replicaGroup] Post Restore replica group. + * + * @param {string} [body.requestId] Post Restore request id. + * + * @param {string} [body.azureFileShareUri] Post Restore Azure file share uri. + * + * @param {string} [body.status] Post Restore Azure status. + * + * @param {string} [body.sourceAzureFileShareUri] Post Restore Azure source + * azure file share uri. + * + * @param {string} [body.failedFileList] Post Restore Azure failed file list. + * + * @param {array} [body.restoreFileSpec] Post Restore restore file spec array. * * @param {object} [options] Optional Parameters. * @@ -1540,14 +1499,14 @@ export interface CloudEndpointPostBackup { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - postWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + postRestoreWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PostRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Post Backup a given CloudEndpoint. + * Post Restore a given CloudEndpoint. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -1559,9 +1518,24 @@ export interface CloudEndpointPostBackup { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Backup request. + * @param {object} body Body of Cloud Endpoint object. * - * @param {string} [body.azureFileShare] Azure File Share. + * @param {string} [body.partition] Post Restore partition. + * + * @param {string} [body.replicaGroup] Post Restore replica group. + * + * @param {string} [body.requestId] Post Restore request id. + * + * @param {string} [body.azureFileShareUri] Post Restore Azure file share uri. + * + * @param {string} [body.status] Post Restore Azure status. + * + * @param {string} [body.sourceAzureFileShareUri] Post Restore Azure source + * azure file share uri. + * + * @param {string} [body.failedFileList] Post Restore Azure failed file list. + * + * @param {array} [body.restoreFileSpec] Post Restore restore file spec array. * * @param {object} [options] Optional Parameters. * @@ -1575,7 +1549,7 @@ export interface CloudEndpointPostBackup { * * {Promise} A promise is returned. * - * @resolve {PostBackupResponse} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1583,20 +1557,19 @@ export interface CloudEndpointPostBackup { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {PostBackupResponse} [result] - The deserialized result object if an error did not occur. - * See {@link PostBackupResponse} for more information. + * {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. */ - post(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - post(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, callback: ServiceCallback): void; - post(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + postRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PostRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + postRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PostRestoreRequest, callback: ServiceCallback): void; + postRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PostRestoreRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Post Backup a given CloudEndpoint. + * Create a new CloudEndpoint. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -1608,9 +1581,25 @@ export interface CloudEndpointPostBackup { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Backup request. + * @param {object} body Body of Cloud Endpoint resource. * - * @param {string} [body.azureFileShare] Azure File Share. + * @param {string} [body.storageAccountKey] Storage Account access key. + * + * @param {string} [body.storageAccount] Storage Account name. + * + * @param {string} [body.storageAccountResourceId] Storage Account Resource Id + * + * @param {string} [body.storageAccountShareName] Storage Account Share name + * + * @param {string} [body.storageAccountTenantId] Storage Account Tenant Id + * + * @param {string} [body.partnershipId] Partnership Id + * + * @param {string} [body.friendlyName] Friendly Name + * + * @param {string} [body.provisioningState] CloudEndpoint Provisioning State + * + * @param {string} [body.lastWorkflowId] CloudEndpoint lastWorkflowId * * @param {object} [options] Optional Parameters. * @@ -1619,14 +1608,14 @@ export interface CloudEndpointPostBackup { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginPostWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginCreateWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.CloudEndpoint, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Post Backup a given CloudEndpoint. + * Create a new CloudEndpoint. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -1638,9 +1627,25 @@ export interface CloudEndpointPostBackup { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Backup request. + * @param {object} body Body of Cloud Endpoint resource. * - * @param {string} [body.azureFileShare] Azure File Share. + * @param {string} [body.storageAccountKey] Storage Account access key. + * + * @param {string} [body.storageAccount] Storage Account name. + * + * @param {string} [body.storageAccountResourceId] Storage Account Resource Id + * + * @param {string} [body.storageAccountShareName] Storage Account Share name + * + * @param {string} [body.storageAccountTenantId] Storage Account Tenant Id + * + * @param {string} [body.partnershipId] Partnership Id + * + * @param {string} [body.friendlyName] Friendly Name + * + * @param {string} [body.provisioningState] CloudEndpoint Provisioning State + * + * @param {string} [body.lastWorkflowId] CloudEndpoint lastWorkflowId * * @param {object} [options] Optional Parameters. * @@ -1654,7 +1659,7 @@ export interface CloudEndpointPostBackup { * * {Promise} A promise is returned. * - * @resolve {PostBackupResponse} - The deserialized result object. + * @resolve {CloudEndpoint} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1662,29 +1667,20 @@ export interface CloudEndpointPostBackup { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {PostBackupResponse} [result] - The deserialized result object if an error did not occur. - * See {@link PostBackupResponse} for more information. + * {CloudEndpoint} [result] - The deserialized result object if an error did not occur. + * See {@link CloudEndpoint} 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. */ - beginPost(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginPost(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, callback: ServiceCallback): void; - beginPost(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * CloudEndpointPreRestore - * __NOTE__: An instance of this class is automatically created for an - * instance of the MicrosoftStorageSync. - */ -export interface CloudEndpointPreRestore { + beginCreate(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.CloudEndpoint, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreate(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.CloudEndpoint, callback: ServiceCallback): void; + beginCreate(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.CloudEndpoint, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Pre Restore a given CloudEndpoint. + * Delete a given CloudEndpoint. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -1696,29 +1692,6 @@ export interface CloudEndpointPreRestore { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Cloud Endpoint object. - * - * @param {string} [body.partition] Pre Restore partition. - * - * @param {string} [body.replicaGroup] Pre Restore replica group. - * - * @param {string} [body.requestId] Pre Restore request id. - * - * @param {string} [body.azureFileShareUri] Pre Restore Azure file share uri. - * - * @param {string} [body.status] Pre Restore Azure status. - * - * @param {string} [body.sourceAzureFileShareUri] Pre Restore Azure source - * azure file share uri. - * - * @param {string} [body.backupMetadataPropertyBag] Pre Restore backup metadata - * property bag. - * - * @param {array} [body.restoreFileSpec] Pre Restore restore file spec array. - * - * @param {number} [body.pausewaitforsyncdraintimeperiodinseconds] Pre Restore - * pause wait for sync drain time period in seconds. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1730,10 +1703,10 @@ export interface CloudEndpointPreRestore { * * @reject {Error|ServiceError} - The error object. */ - postWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PreRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Pre Restore a given CloudEndpoint. + * Delete a given CloudEndpoint. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -1745,29 +1718,6 @@ export interface CloudEndpointPreRestore { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Cloud Endpoint object. - * - * @param {string} [body.partition] Pre Restore partition. - * - * @param {string} [body.replicaGroup] Pre Restore replica group. - * - * @param {string} [body.requestId] Pre Restore request id. - * - * @param {string} [body.azureFileShareUri] Pre Restore Azure file share uri. - * - * @param {string} [body.status] Pre Restore Azure status. - * - * @param {string} [body.sourceAzureFileShareUri] Pre Restore Azure source - * azure file share uri. - * - * @param {string} [body.backupMetadataPropertyBag] Pre Restore backup metadata - * property bag. - * - * @param {array} [body.restoreFileSpec] Pre Restore restore file spec array. - * - * @param {number} [body.pausewaitforsyncdraintimeperiodinseconds] Pre Restore - * pause wait for sync drain time period in seconds. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1794,13 +1744,13 @@ export interface CloudEndpointPreRestore { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - post(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PreRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - post(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PreRestoreRequest, callback: ServiceCallback): void; - post(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PreRestoreRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Pre Restore a given CloudEndpoint. + * Pre Backup a given CloudEndpoint. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -1812,28 +1762,9 @@ export interface CloudEndpointPreRestore { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Cloud Endpoint object. - * - * @param {string} [body.partition] Pre Restore partition. - * - * @param {string} [body.replicaGroup] Pre Restore replica group. - * - * @param {string} [body.requestId] Pre Restore request id. - * - * @param {string} [body.azureFileShareUri] Pre Restore Azure file share uri. - * - * @param {string} [body.status] Pre Restore Azure status. - * - * @param {string} [body.sourceAzureFileShareUri] Pre Restore Azure source - * azure file share uri. - * - * @param {string} [body.backupMetadataPropertyBag] Pre Restore backup metadata - * property bag. - * - * @param {array} [body.restoreFileSpec] Pre Restore restore file spec array. + * @param {object} body Body of Backup request. * - * @param {number} [body.pausewaitforsyncdraintimeperiodinseconds] Pre Restore - * pause wait for sync drain time period in seconds. + * @param {string} [body.azureFileShare] Azure File Share. * * @param {object} [options] Optional Parameters. * @@ -1846,10 +1777,10 @@ export interface CloudEndpointPreRestore { * * @reject {Error|ServiceError} - The error object. */ - beginPostWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PreRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginPreBackupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Pre Restore a given CloudEndpoint. + * Pre Backup a given CloudEndpoint. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -1861,28 +1792,9 @@ export interface CloudEndpointPreRestore { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Cloud Endpoint object. - * - * @param {string} [body.partition] Pre Restore partition. - * - * @param {string} [body.replicaGroup] Pre Restore replica group. - * - * @param {string} [body.requestId] Pre Restore request id. - * - * @param {string} [body.azureFileShareUri] Pre Restore Azure file share uri. - * - * @param {string} [body.status] Pre Restore Azure status. - * - * @param {string} [body.sourceAzureFileShareUri] Pre Restore Azure source - * azure file share uri. - * - * @param {string} [body.backupMetadataPropertyBag] Pre Restore backup metadata - * property bag. - * - * @param {array} [body.restoreFileSpec] Pre Restore restore file spec array. + * @param {object} body Body of Backup request. * - * @param {number} [body.pausewaitforsyncdraintimeperiodinseconds] Pre Restore - * pause wait for sync drain time period in seconds. + * @param {string} [body.azureFileShare] Azure File Share. * * @param {object} [options] Optional Parameters. * @@ -1910,22 +1822,13 @@ export interface CloudEndpointPreRestore { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginPost(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PreRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginPost(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PreRestoreRequest, callback: ServiceCallback): void; - beginPost(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PreRestoreRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * CloudEndpointRestoreHeatbeat - * __NOTE__: An instance of this class is automatically created for an - * instance of the MicrosoftStorageSync. - */ -export interface CloudEndpointRestoreHeatbeat { + beginPreBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginPreBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, callback: ServiceCallback): void; + beginPreBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Restore Heartbeat a given CloudEndpoint. + * Post Backup a given CloudEndpoint. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -1937,6 +1840,10 @@ export interface CloudEndpointRestoreHeatbeat { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1944,14 +1851,14 @@ export interface CloudEndpointRestoreHeatbeat { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - postWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginPostBackupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Restore Heartbeat a given CloudEndpoint. + * Post Backup a given CloudEndpoint. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -1963,6 +1870,10 @@ export interface CloudEndpointRestoreHeatbeat { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * + * @param {object} body Body of Backup request. + * + * @param {string} [body.azureFileShare] Azure File Share. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1975,7 +1886,7 @@ export interface CloudEndpointRestoreHeatbeat { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {PostBackupResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1983,28 +1894,20 @@ export interface CloudEndpointRestoreHeatbeat { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {PostBackupResponse} [result] - The deserialized result object if an error did not occur. + * See {@link PostBackupResponse} 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. */ - post(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - post(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, callback: ServiceCallback): void; - post(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * CloudEndpointPostRestore - * __NOTE__: An instance of this class is automatically created for an - * instance of the MicrosoftStorageSync. - */ -export interface CloudEndpointPostRestore { + beginPostBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginPostBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, callback: ServiceCallback): void; + beginPostBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Post Restore a given CloudEndpoint. + * Pre Restore a given CloudEndpoint. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -2018,22 +1921,26 @@ export interface CloudEndpointPostRestore { * * @param {object} body Body of Cloud Endpoint object. * - * @param {string} [body.partition] Post Restore partition. + * @param {string} [body.partition] Pre Restore partition. * - * @param {string} [body.replicaGroup] Post Restore replica group. + * @param {string} [body.replicaGroup] Pre Restore replica group. * - * @param {string} [body.requestId] Post Restore request id. + * @param {string} [body.requestId] Pre Restore request id. * - * @param {string} [body.azureFileShareUri] Post Restore Azure file share uri. + * @param {string} [body.azureFileShareUri] Pre Restore Azure file share uri. * - * @param {string} [body.status] Post Restore Azure status. + * @param {string} [body.status] Pre Restore Azure status. * - * @param {string} [body.sourceAzureFileShareUri] Post Restore Azure source + * @param {string} [body.sourceAzureFileShareUri] Pre Restore Azure source * azure file share uri. * - * @param {string} [body.failedFileList] Post Restore Azure failed file list. + * @param {string} [body.backupMetadataPropertyBag] Pre Restore backup metadata + * property bag. * - * @param {array} [body.restoreFileSpec] Post Restore restore file spec array. + * @param {array} [body.restoreFileSpec] Pre Restore restore file spec array. + * + * @param {number} [body.pauseWaitForSyncDrainTimePeriodInSeconds] Pre Restore + * pause wait for sync drain time period in seconds. * * @param {object} [options] Optional Parameters. * @@ -2046,10 +1953,10 @@ export interface CloudEndpointPostRestore { * * @reject {Error|ServiceError} - The error object. */ - postWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PostRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginPreRestoreWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PreRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Post Restore a given CloudEndpoint. + * Pre Restore a given CloudEndpoint. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -2063,22 +1970,26 @@ export interface CloudEndpointPostRestore { * * @param {object} body Body of Cloud Endpoint object. * - * @param {string} [body.partition] Post Restore partition. + * @param {string} [body.partition] Pre Restore partition. * - * @param {string} [body.replicaGroup] Post Restore replica group. + * @param {string} [body.replicaGroup] Pre Restore replica group. * - * @param {string} [body.requestId] Post Restore request id. + * @param {string} [body.requestId] Pre Restore request id. * - * @param {string} [body.azureFileShareUri] Post Restore Azure file share uri. + * @param {string} [body.azureFileShareUri] Pre Restore Azure file share uri. * - * @param {string} [body.status] Post Restore Azure status. + * @param {string} [body.status] Pre Restore Azure status. * - * @param {string} [body.sourceAzureFileShareUri] Post Restore Azure source + * @param {string} [body.sourceAzureFileShareUri] Pre Restore Azure source * azure file share uri. * - * @param {string} [body.failedFileList] Post Restore Azure failed file list. + * @param {string} [body.backupMetadataPropertyBag] Pre Restore backup metadata + * property bag. * - * @param {array} [body.restoreFileSpec] Post Restore restore file spec array. + * @param {array} [body.restoreFileSpec] Pre Restore restore file spec array. + * + * @param {number} [body.pauseWaitForSyncDrainTimePeriodInSeconds] Pre Restore + * pause wait for sync drain time period in seconds. * * @param {object} [options] Optional Parameters. * @@ -2106,9 +2017,9 @@ export interface CloudEndpointPostRestore { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - post(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PostRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - post(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PostRestoreRequest, callback: ServiceCallback): void; - post(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PostRestoreRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginPreRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PreRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginPreRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PreRestoreRequest, callback: ServiceCallback): void; + beginPreRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PreRestoreRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -2154,7 +2065,7 @@ export interface CloudEndpointPostRestore { * * @reject {Error|ServiceError} - The error object. */ - beginPostWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PostRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginPostRestoreWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PostRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Post Restore a given CloudEndpoint. @@ -2214,16 +2125,16 @@ export interface CloudEndpointPostRestore { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginPost(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PostRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginPost(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PostRestoreRequest, callback: ServiceCallback): void; - beginPost(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PostRestoreRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginPostRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PostRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginPostRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PostRestoreRequest, callback: ServiceCallback): void; + beginPostRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PostRestoreRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** * @class * ServerEndpoints * __NOTE__: An instance of this class is automatically created for an - * instance of the MicrosoftStorageSync. + * instance of the StorageSyncManagementClient. */ export interface ServerEndpoints { @@ -2501,40 +2412,182 @@ export interface ServerEndpoints { * * @param {string} [options.body.syncErrorState] Sync Error State * - * @param {date} [options.body.syncErrorStateTimestamp] Sync Error State - * Timestamp + * @param {date} [options.body.syncErrorStateTimestamp] Sync Error State + * Timestamp + * + * @param {string} [options.body.syncErrorDirection] Sync Error Direction. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [options.body.itemUploadErrorCount] Item Upload Error Count. + * + * @param {number} [options.body.itemDownloadErrorCount] Item download error + * count. + * + * @param {string} [options.body.syncErrorContext] sync error context. + * + * @param {string} [options.body.currentProgressType] current progress type. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [options.body.itemProgressCount] Item Progress Count + * + * @param {number} [options.body.itemTotalCount] Item Total Count + * + * @param {number} [options.body.byteProgress] Bytes in progress + * + * @param {number} [options.body.totalProgress] Total progress + * + * @param {number} [options.body.byteTotal] Bytes total + * + * @param {string} [options.body.serverResourceId] Server Resource Id. + * + * @param {string} [options.body.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [options.body.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @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 {ServerEndpoint} - 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. + * + * {ServerEndpoint} [result] - The deserialized result object if an error did not occur. + * See {@link ServerEndpoint} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { body? : models.ServerEndpoint, customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, callback: ServiceCallback): void; + update(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options: { body? : models.ServerEndpoint, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get a ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get a ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @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 {ServerEndpoint} - 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. + * + * {ServerEndpoint} [result] - The deserialized result object if an error did not occur. + * See {@link ServerEndpoint} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete a given ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. * - * @param {string} [options.body.syncErrorDirection] Sync Error Direction. - * Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. * - * @param {number} [options.body.itemUploadErrorCount] Item Upload Error Count. + * @param {string} syncGroupName Name of Sync Group resource. * - * @param {number} [options.body.itemDownloadErrorCount] Item download error - * count. + * @param {string} serverEndpointName Name of Server Endpoint object. * - * @param {string} [options.body.syncErrorContext] sync error context. + * @param {object} [options] Optional Parameters. * - * @param {string} [options.body.currentProgressType] current progress type. - * Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {number} [options.body.itemProgressCount] Item Progress Count + * @returns {Promise} A promise is returned * - * @param {number} [options.body.itemTotalCount] Item Total Count + * @resolve {HttpOperationResponse} - The deserialized result object. * - * @param {number} [options.body.byteProgress] Bytes in progress + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete a given ServerEndpoint. * - * @param {number} [options.body.totalProgress] Total progress + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. * - * @param {number} [options.body.byteTotal] Bytes total + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. * - * @param {string} [options.body.serverResourceId] Server Resource Id. + * @param {string} syncGroupName Name of Sync Group resource. * - * @param {string} [options.body.provisioningState] ServerEndpoint Provisioning - * State + * @param {string} serverEndpointName Name of Server Endpoint object. * - * @param {string} [options.body.lastWorkflowId] ServerEndpoint lastWorkflowId + * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -2546,7 +2599,7 @@ export interface ServerEndpoints { * * {Promise} A promise is returned. * - * @resolve {ServerEndpoint} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2554,20 +2607,19 @@ export interface ServerEndpoints { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ServerEndpoint} [result] - The deserialized result object if an error did not occur. - * See {@link ServerEndpoint} for more information. + * {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. */ - update(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { body? : models.ServerEndpoint, customHeaders? : { [headerName: string]: string; } }): Promise; - update(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, callback: ServiceCallback): void; - update(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options: { body? : models.ServerEndpoint, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Get a ServerEndpoint. + * Get a ServerEndpoint list. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -2577,8 +2629,6 @@ export interface ServerEndpoints { * * @param {string} syncGroupName Name of Sync Group resource. * - * @param {string} serverEndpointName Name of Server Endpoint object. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -2586,14 +2636,14 @@ export interface ServerEndpoints { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listBySyncGroupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Get a ServerEndpoint. + * Get a ServerEndpoint list. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -2603,8 +2653,6 @@ export interface ServerEndpoints { * * @param {string} syncGroupName Name of Sync Group resource. * - * @param {string} serverEndpointName Name of Server Endpoint object. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -2617,7 +2665,7 @@ export interface ServerEndpoints { * * {Promise} A promise is returned. * - * @resolve {ServerEndpoint} - The deserialized result object. + * @resolve {ServerEndpointArray} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2625,20 +2673,20 @@ export interface ServerEndpoints { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ServerEndpoint} [result] - The deserialized result object if an error did not occur. - * See {@link ServerEndpoint} for more information. + * {ServerEndpointArray} [result] - The deserialized result object if an error did not occur. + * See {@link ServerEndpointArray} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - get(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listBySyncGroup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBySyncGroup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, callback: ServiceCallback): void; + listBySyncGroup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Delete a given ServerEndpoint. + * Recall a serverendpoint. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -2661,10 +2709,10 @@ export interface ServerEndpoints { * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + recallWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Delete a given ServerEndpoint. + * Recall a serverendpoint. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -2702,9 +2750,9 @@ export interface ServerEndpoints { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + recall(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + recall(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, callback: ServiceCallback): void; + recall(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -3113,161 +3161,6 @@ export interface ServerEndpoints { beginDeleteMethod(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; beginDeleteMethod(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, callback: ServiceCallback): void; beginDeleteMethod(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * ServerEndpointsGet - * __NOTE__: An instance of this class is automatically created for an - * instance of the MicrosoftStorageSync. - */ -export interface ServerEndpointsGet { - - - /** - * Get a ServerEndpoint list. - * - * @param {string} resourceGroupName The name of the resource group within the - * user's subscription. The name is case insensitive. - * - * @param {string} storageSyncServiceName Name of Storage Sync Service - * resource. - * - * @param {string} syncGroupName Name of Sync Group resource. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @returns {Promise} A promise is returned - * - * @resolve {HttpOperationResponse} - The deserialized result object. - * - * @reject {Error|ServiceError} - The error object. - */ - listBySyncGroupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Get a ServerEndpoint list. - * - * @param {string} resourceGroupName The name of the resource group within the - * user's subscription. The name is case insensitive. - * - * @param {string} storageSyncServiceName Name of Storage Sync Service - * resource. - * - * @param {string} syncGroupName Name of Sync Group resource. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @param {ServiceCallback} [optionalCallback] - The optional callback. - * - * @returns {ServiceCallback|Promise} If a callback was passed as the last - * parameter then it returns the callback else returns a Promise. - * - * {Promise} A promise is returned. - * - * @resolve {ServerEndpointArray} - 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. - * - * {ServerEndpointArray} [result] - The deserialized result object if an error did not occur. - * See {@link ServerEndpointArray} 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. - */ - listBySyncGroup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listBySyncGroup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, callback: ServiceCallback): void; - listBySyncGroup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * ServerEndpointRecall - * __NOTE__: An instance of this class is automatically created for an - * instance of the MicrosoftStorageSync. - */ -export interface ServerEndpointRecall { - - - /** - * Recall a serverendpoint. - * - * @param {string} resourceGroupName The name of the resource group within the - * user's subscription. The name is case insensitive. - * - * @param {string} storageSyncServiceName Name of Storage Sync Service - * resource. - * - * @param {string} syncGroupName Name of Sync Group resource. - * - * @param {string} serverEndpointName Name of Server Endpoint object. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [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. - */ - postWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Recall a serverendpoint. - * - * @param {string} resourceGroupName The name of the resource group within the - * user's subscription. The name is case insensitive. - * - * @param {string} storageSyncServiceName Name of Storage Sync Service - * resource. - * - * @param {string} syncGroupName Name of Sync Group resource. - * - * @param {string} serverEndpointName Name of Server Endpoint object. - * - * @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. - */ - post(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - post(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, callback: ServiceCallback): void; - post(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -3294,7 +3187,7 @@ export interface ServerEndpointRecall { * * @reject {Error|ServiceError} - The error object. */ - beginPostWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginRecallWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Recall a serverendpoint. @@ -3335,18 +3228,18 @@ export interface ServerEndpointRecall { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginPost(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginPost(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, callback: ServiceCallback): void; - beginPost(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginRecall(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginRecall(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, callback: ServiceCallback): void; + beginRecall(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** * @class - * RegisteredServersGet + * RegisteredServers * __NOTE__: An instance of this class is automatically created for an - * instance of the MicrosoftStorageSync. + * instance of the StorageSyncManagementClient. */ -export interface RegisteredServersGet { +export interface RegisteredServers { /** @@ -3410,15 +3303,6 @@ export interface RegisteredServersGet { listByStorageSyncService(resourceGroupName: string, storageSyncServiceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; listByStorageSyncService(resourceGroupName: string, storageSyncServiceName: string, callback: ServiceCallback): void; listByStorageSyncService(resourceGroupName: string, storageSyncServiceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * RegisteredServers - * __NOTE__: An instance of this class is automatically created for an - * instance of the MicrosoftStorageSync. - */ -export interface RegisteredServers { /** @@ -3874,7 +3758,7 @@ export interface RegisteredServers { * @class * Workflows * __NOTE__: An instance of this class is automatically created for an - * instance of the MicrosoftStorageSync. + * instance of the StorageSyncManagementClient. */ export interface Workflows { @@ -3944,15 +3828,6 @@ export interface Workflows { get(resourceGroupName: string, storageSyncServiceName: string, workflowId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; get(resourceGroupName: string, storageSyncServiceName: string, workflowId: string, callback: ServiceCallback): void; get(resourceGroupName: string, storageSyncServiceName: string, workflowId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * AbortWorkflows - * __NOTE__: An instance of this class is automatically created for an - * instance of the MicrosoftStorageSync. - */ -export interface AbortWorkflows { /** @@ -3977,7 +3852,7 @@ export interface AbortWorkflows { * * @reject {Error|ServiceError} - The error object. */ - postWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, workflowId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + abortWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, workflowId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Abort the given workflow. @@ -4016,7 +3891,7 @@ export interface AbortWorkflows { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - post(resourceGroupName: string, storageSyncServiceName: string, workflowId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - post(resourceGroupName: string, storageSyncServiceName: string, workflowId: string, callback: ServiceCallback): void; - post(resourceGroupName: string, storageSyncServiceName: string, workflowId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + abort(resourceGroupName: string, storageSyncServiceName: string, workflowId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + abort(resourceGroupName: string, storageSyncServiceName: string, workflowId: string, callback: ServiceCallback): void; + abort(resourceGroupName: string, storageSyncServiceName: string, workflowId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } diff --git a/lib/services/storagesyncManagement/lib/operations/index.js b/lib/services/storagesyncManagement/lib/operations/index.js index 8914e451fc..9f76216fd2 100644 --- a/lib/services/storagesyncManagement/lib/operations/index.js +++ b/lib/services/storagesyncManagement/lib/operations/index.js @@ -14,23 +14,10 @@ 'use strict'; -exports.OperationGet = require('./operationGet'); +exports.Operations = require('./operations'); exports.StorageSyncServices = require('./storageSyncServices'); -exports.StorageSyncServiceByResourceGroupGet = require('./storageSyncServiceByResourceGroupGet'); -exports.StorageSyncServiceGet = require('./storageSyncServiceGet'); -exports.GetSyncGroups = require('./getSyncGroups'); exports.SyncGroups = require('./syncGroups'); exports.CloudEndpoints = require('./cloudEndpoints'); -exports.CloudEndpointsGet = require('./cloudEndpointsGet'); -exports.CloudEndpointPreBackup = require('./cloudEndpointPreBackup'); -exports.CloudEndpointPostBackup = require('./cloudEndpointPostBackup'); -exports.CloudEndpointPreRestore = require('./cloudEndpointPreRestore'); -exports.CloudEndpointRestoreHeatbeat = require('./cloudEndpointRestoreHeatbeat'); -exports.CloudEndpointPostRestore = require('./cloudEndpointPostRestore'); exports.ServerEndpoints = require('./serverEndpoints'); -exports.ServerEndpointsGet = require('./serverEndpointsGet'); -exports.ServerEndpointRecall = require('./serverEndpointRecall'); -exports.RegisteredServersGet = require('./registeredServersGet'); exports.RegisteredServers = require('./registeredServers'); exports.Workflows = require('./workflows'); -exports.AbortWorkflows = require('./abortWorkflows'); diff --git a/lib/services/storagesyncManagement/lib/operations/operations.js b/lib/services/storagesyncManagement/lib/operations/operations.js new file mode 100644 index 0000000000..2fc78f7549 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/operations.js @@ -0,0 +1,455 @@ +/* + * 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 all of the available Storage Sync Rest API operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationEntityListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.StorageSync/operations'; + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['StorageSyncError']().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['OperationEntityListResult']().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); + }); +} + +/** + * Lists all of the available Storage Sync Rest API operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationEntityListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['StorageSyncError']().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['OperationEntityListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a Operations. */ +class Operations { + /** + * Create a Operations. + * @param {StorageSyncManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._listNext = _listNext; + } + + /** + * Lists all of the available Storage Sync Rest API operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all of the available Storage Sync Rest API operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {OperationEntityListResult} - 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 OperationEntityListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + + /** + * Lists all of the available Storage Sync Rest API operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all of the available Storage Sync Rest API operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {OperationEntityListResult} - 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 OperationEntityListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = Operations; diff --git a/lib/services/storagesyncManagement/lib/operations/registeredServers.js b/lib/services/storagesyncManagement/lib/operations/registeredServers.js index 90c804b5aa..f2c527ff98 100644 --- a/lib/services/storagesyncManagement/lib/operations/registeredServers.js +++ b/lib/services/storagesyncManagement/lib/operations/registeredServers.js @@ -14,6 +14,168 @@ const msRest = require('ms-rest'); const msRestAzure = require('ms-rest-azure'); const WebResource = msRest.WebResource; +/** + * Get a given registered server list. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RegisteredServerArray} 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 _listByStorageSyncService(resourceGroupName, storageSyncServiceName, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName 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.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + 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['StorageSyncError']().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['RegisteredServerArray']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + /** * Get a given registered server. * @@ -147,7 +309,7 @@ function _get(resourceGroupName, storageSyncServiceName, serverId, options, call error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['ErrorModel']().mapper(); + let resultMapper = new client.models['StorageSyncError']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -539,7 +701,7 @@ function _beginCreate(resourceGroupName, storageSyncServiceName, serverId, body, error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['ErrorModel']().mapper(); + let resultMapper = new client.models['StorageSyncError']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -706,7 +868,7 @@ function _beginDeleteMethod(resourceGroupName, storageSyncServiceName, serverId, error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['ErrorModel']().mapper(); + let resultMapper = new client.models['StorageSyncError']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -728,10 +890,11 @@ function _beginDeleteMethod(resourceGroupName, storageSyncServiceName, serverId, class RegisteredServers { /** * Create a RegisteredServers. - * @param {MicrosoftStorageSync} client Reference to the service client. + * @param {StorageSyncManagementClient} client Reference to the service client. */ constructor(client) { this.client = client; + this._listByStorageSyncService = _listByStorageSyncService; this._get = _get; this._create = _create; this._deleteMethod = _deleteMethod; @@ -739,6 +902,96 @@ class RegisteredServers { this._beginDeleteMethod = _beginDeleteMethod; } + /** + * Get a given registered server list. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByStorageSyncServiceWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByStorageSyncService(resourceGroupName, storageSyncServiceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get a given registered server list. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {RegisteredServerArray} - 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 RegisteredServerArray} 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. + */ + listByStorageSyncService(resourceGroupName, storageSyncServiceName, 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._listByStorageSyncService(resourceGroupName, storageSyncServiceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByStorageSyncService(resourceGroupName, storageSyncServiceName, options, optionalCallback); + } + } + /** * Get a given registered server. * diff --git a/lib/services/storagesyncManagement/lib/operations/serverEndpoints.js b/lib/services/storagesyncManagement/lib/operations/serverEndpoints.js index ada09c7940..a2785badf4 100644 --- a/lib/services/storagesyncManagement/lib/operations/serverEndpoints.js +++ b/lib/services/storagesyncManagement/lib/operations/serverEndpoints.js @@ -419,7 +419,7 @@ function _get(resourceGroupName, storageSyncServiceName, syncGroupName, serverEn error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['ErrorModel']().mapper(); + let resultMapper = new client.models['StorageSyncError']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -523,6 +523,243 @@ function _deleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, }); } +/** + * Get a ServerEndpoint list. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ServerEndpointArray} 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 _listBySyncGroup(resourceGroupName, storageSyncServiceName, syncGroupName, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName cannot be null or undefined and it must be of type string.'); + } + if (syncGroupName === null || syncGroupName === undefined || typeof syncGroupName.valueOf() !== 'string') { + throw new Error('syncGroupName 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.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + requestUrl = requestUrl.replace('{syncGroupName}', encodeURIComponent(syncGroupName)); + 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['StorageSyncError']().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['ServerEndpointArray']().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); + }); +} + + +/** + * Recall a serverendpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @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 _recall(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, 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.beginRecall(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + /** * Create a new ServerEndpoint. * @@ -725,7 +962,7 @@ function _beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['ErrorModel']().mapper(); + let resultMapper = new client.models['StorageSyncError']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -966,7 +1203,7 @@ function _beginUpdate(resourceGroupName, storageSyncServiceName, syncGroupName, error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['ErrorModel']().mapper(); + let resultMapper = new client.models['StorageSyncError']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -1139,7 +1376,7 @@ function _beginDeleteMethod(resourceGroupName, storageSyncServiceName, syncGroup error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['ErrorModel']().mapper(); + let resultMapper = new client.models['StorageSyncError']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -1157,35 +1394,194 @@ function _beginDeleteMethod(resourceGroupName, storageSyncServiceName, syncGroup }); } -/** Class representing a ServerEndpoints. */ -class ServerEndpoints { - /** - * Create a ServerEndpoints. - * @param {MicrosoftStorageSync} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._create = _create; - this._update = _update; - this._get = _get; - this._deleteMethod = _deleteMethod; - this._beginCreate = _beginCreate; - this._beginUpdate = _beginUpdate; - this._beginDeleteMethod = _beginDeleteMethod; - } - - /** - * Create a new ServerEndpoint. - * - * @param {string} resourceGroupName The name of the resource group within the - * user's subscription. The name is case insensitive. - * - * @param {string} storageSyncServiceName Name of Storage Sync Service - * resource. - * - * @param {string} syncGroupName Name of Sync Group resource. - * - * @param {string} serverEndpointName Name of Server Endpoint object. +/** + * Recall a serverendpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @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 _beginRecall(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName cannot be null or undefined and it must be of type string.'); + } + if (syncGroupName === null || syncGroupName === undefined || typeof syncGroupName.valueOf() !== 'string') { + throw new Error('syncGroupName cannot be null or undefined and it must be of type string.'); + } + if (serverEndpointName === null || serverEndpointName === undefined || typeof serverEndpointName.valueOf() !== 'string') { + throw new Error('serverEndpointName 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.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}/recallAction'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + requestUrl = requestUrl.replace('{syncGroupName}', encodeURIComponent(syncGroupName)); + requestUrl = requestUrl.replace('{serverEndpointName}', encodeURIComponent(serverEndpointName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['StorageSyncError']().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 ServerEndpoints. */ +class ServerEndpoints { + /** + * Create a ServerEndpoints. + * @param {StorageSyncManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._create = _create; + this._update = _update; + this._get = _get; + this._deleteMethod = _deleteMethod; + this._listBySyncGroup = _listBySyncGroup; + this._recall = _recall; + this._beginCreate = _beginCreate; + this._beginUpdate = _beginUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginRecall = _beginRecall; + } + + /** + * Create a new ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. * * @param {object} body Body of Server Endpoint object. * @@ -1309,13 +1705,313 @@ class ServerEndpoints { * * @param {number} [body.totalProgress] Total progress * - * @param {number} [body.byteTotal] Bytes total + * @param {number} [body.byteTotal] Bytes total + * + * @param {string} [body.serverResourceId] Server Resource Id. + * + * @param {string} [body.provisioningState] ServerEndpoint Provisioning State + * + * @param {string} [body.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @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 {ServerEndpoint} - 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 ServerEndpoint} 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. + */ + create(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, body, 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, storageSyncServiceName, syncGroupName, serverEndpointName, body, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, body, options, optionalCallback); + } + } + + /** + * Patch a given ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.body] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.body.serverLocalPath] Server Local path. + * + * @param {string} [options.body.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [options.body.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.body.friendlyName] Friendly Name + * + * @param {date} [options.body.lastSyncSuccess] Last Sync Success + * + * @param {string} [options.body.syncErrorState] Sync Error State + * + * @param {date} [options.body.syncErrorStateTimestamp] Sync Error State + * Timestamp + * + * @param {string} [options.body.syncErrorDirection] Sync Error Direction. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [options.body.itemUploadErrorCount] Item Upload Error Count. + * + * @param {number} [options.body.itemDownloadErrorCount] Item download error + * count. + * + * @param {string} [options.body.syncErrorContext] sync error context. + * + * @param {string} [options.body.currentProgressType] current progress type. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [options.body.itemProgressCount] Item Progress Count + * + * @param {number} [options.body.itemTotalCount] Item Total Count + * + * @param {number} [options.body.byteProgress] Bytes in progress + * + * @param {number} [options.body.totalProgress] Total progress + * + * @param {number} [options.body.byteTotal] Bytes total + * + * @param {string} [options.body.serverResourceId] Server Resource Id. + * + * @param {string} [options.body.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [options.body.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Patch a given ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.body] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.body.serverLocalPath] Server Local path. + * + * @param {string} [options.body.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [options.body.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.body.friendlyName] Friendly Name + * + * @param {date} [options.body.lastSyncSuccess] Last Sync Success + * + * @param {string} [options.body.syncErrorState] Sync Error State + * + * @param {date} [options.body.syncErrorStateTimestamp] Sync Error State + * Timestamp + * + * @param {string} [options.body.syncErrorDirection] Sync Error Direction. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [options.body.itemUploadErrorCount] Item Upload Error Count. + * + * @param {number} [options.body.itemDownloadErrorCount] Item download error + * count. + * + * @param {string} [options.body.syncErrorContext] sync error context. + * + * @param {string} [options.body.currentProgressType] current progress type. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [options.body.itemProgressCount] Item Progress Count + * + * @param {number} [options.body.itemTotalCount] Item Total Count + * + * @param {number} [options.body.byteProgress] Bytes in progress + * + * @param {number} [options.body.totalProgress] Total progress + * + * @param {number} [options.body.byteTotal] Bytes total + * + * @param {string} [options.body.serverResourceId] Server Resource Id. + * + * @param {string} [options.body.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [options.body.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @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 {ServerEndpoint} - 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 ServerEndpoint} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, optionalCallback); + } + } + + /** + * Get a ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, storageSyncServiceName, syncGroupName, serverEndpointName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get a ServerEndpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. * - * @param {string} [body.serverResourceId] Server Resource Id. + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. * - * @param {string} [body.provisioningState] ServerEndpoint Provisioning State + * @param {string} syncGroupName Name of Sync Group resource. * - * @param {string} [body.lastWorkflowId] ServerEndpoint lastWorkflowId + * @param {string} serverEndpointName Name of Server Endpoint object. * * @param {object} [options] Optional Parameters. * @@ -1344,7 +2040,7 @@ class ServerEndpoints { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - create(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, body, options, optionalCallback) { + get(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -1353,19 +2049,19 @@ class ServerEndpoints { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._create(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, body, options, (err, result, request, response) => { + self._get(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._create(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, body, options, optionalCallback); + return self._get(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, optionalCallback); } } /** - * Patch a given ServerEndpoint. + * Delete a given ServerEndpoint. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -1379,72 +2075,20 @@ class ServerEndpoints { * * @param {object} [options] Optional Parameters. * - * @param {object} [options.body] Any of the properties applicable in PUT - * request. - * - * @param {string} [options.body.serverLocalPath] Server Local path. - * - * @param {string} [options.body.cloudTiering] Cloud Tiering. Possible values - * include: 'on', 'off' - * - * @param {number} [options.body.volumeFreeSpacePercent] Level of free space to - * be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [options.body.friendlyName] Friendly Name - * - * @param {date} [options.body.lastSyncSuccess] Last Sync Success - * - * @param {string} [options.body.syncErrorState] Sync Error State - * - * @param {date} [options.body.syncErrorStateTimestamp] Sync Error State - * Timestamp - * - * @param {string} [options.body.syncErrorDirection] Sync Error Direction. - * Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' - * - * @param {number} [options.body.itemUploadErrorCount] Item Upload Error Count. - * - * @param {number} [options.body.itemDownloadErrorCount] Item download error - * count. - * - * @param {string} [options.body.syncErrorContext] sync error context. - * - * @param {string} [options.body.currentProgressType] current progress type. - * Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' - * - * @param {number} [options.body.itemProgressCount] Item Progress Count - * - * @param {number} [options.body.itemTotalCount] Item Total Count - * - * @param {number} [options.body.byteProgress] Bytes in progress - * - * @param {number} [options.body.totalProgress] Total progress - * - * @param {number} [options.body.byteTotal] Bytes total - * - * @param {string} [options.body.serverResourceId] Server Resource Id. - * - * @param {string} [options.body.provisioningState] ServerEndpoint Provisioning - * State - * - * @param {string} [options.body.lastWorkflowId] ServerEndpoint lastWorkflowId - * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - updateWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options) { + deleteMethodWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._update(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { + self._deleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1455,7 +2099,7 @@ class ServerEndpoints { } /** - * Patch a given ServerEndpoint. + * Delete a given ServerEndpoint. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -1469,58 +2113,6 @@ class ServerEndpoints { * * @param {object} [options] Optional Parameters. * - * @param {object} [options.body] Any of the properties applicable in PUT - * request. - * - * @param {string} [options.body.serverLocalPath] Server Local path. - * - * @param {string} [options.body.cloudTiering] Cloud Tiering. Possible values - * include: 'on', 'off' - * - * @param {number} [options.body.volumeFreeSpacePercent] Level of free space to - * be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [options.body.friendlyName] Friendly Name - * - * @param {date} [options.body.lastSyncSuccess] Last Sync Success - * - * @param {string} [options.body.syncErrorState] Sync Error State - * - * @param {date} [options.body.syncErrorStateTimestamp] Sync Error State - * Timestamp - * - * @param {string} [options.body.syncErrorDirection] Sync Error Direction. - * Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' - * - * @param {number} [options.body.itemUploadErrorCount] Item Upload Error Count. - * - * @param {number} [options.body.itemDownloadErrorCount] Item download error - * count. - * - * @param {string} [options.body.syncErrorContext] sync error context. - * - * @param {string} [options.body.currentProgressType] current progress type. - * Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' - * - * @param {number} [options.body.itemProgressCount] Item Progress Count - * - * @param {number} [options.body.itemTotalCount] Item Total Count - * - * @param {number} [options.body.byteProgress] Bytes in progress - * - * @param {number} [options.body.totalProgress] Total progress - * - * @param {number} [options.body.byteTotal] Bytes total - * - * @param {string} [options.body.serverResourceId] Server Resource Id. - * - * @param {string} [options.body.provisioningState] ServerEndpoint Provisioning - * State - * - * @param {string} [options.body.lastWorkflowId] ServerEndpoint lastWorkflowId - * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -1531,7 +2123,7 @@ class ServerEndpoints { * * {Promise} A promise is returned * - * @resolve {ServerEndpoint} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error} - The error object. * @@ -1539,14 +2131,13 @@ class ServerEndpoints { * * {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 ServerEndpoint} for more information. + * {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. */ - update(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, optionalCallback) { + deleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -1555,19 +2146,19 @@ class ServerEndpoints { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._update(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { + self._deleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._update(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, optionalCallback); + return self._deleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, optionalCallback); } } /** - * Get a ServerEndpoint. + * Get a ServerEndpoint list. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -1577,8 +2168,6 @@ class ServerEndpoints { * * @param {string} syncGroupName Name of Sync Group resource. * - * @param {string} serverEndpointName Name of Server Endpoint object. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1586,15 +2175,15 @@ class ServerEndpoints { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - getWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options) { + listBySyncGroupWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._get(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { + self._listBySyncGroup(resourceGroupName, storageSyncServiceName, syncGroupName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1605,7 +2194,7 @@ class ServerEndpoints { } /** - * Get a ServerEndpoint. + * Get a ServerEndpoint list. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -1615,8 +2204,6 @@ class ServerEndpoints { * * @param {string} syncGroupName Name of Sync Group resource. * - * @param {string} serverEndpointName Name of Server Endpoint object. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1629,7 +2216,7 @@ class ServerEndpoints { * * {Promise} A promise is returned * - * @resolve {ServerEndpoint} - The deserialized result object. + * @resolve {ServerEndpointArray} - The deserialized result object. * * @reject {Error} - The error object. * @@ -1638,13 +2225,13 @@ class ServerEndpoints { * {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 ServerEndpoint} for more information. + * See {@link ServerEndpointArray} 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, storageSyncServiceName, syncGroupName, serverEndpointName, options, optionalCallback) { + listBySyncGroup(resourceGroupName, storageSyncServiceName, syncGroupName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -1653,19 +2240,19 @@ class ServerEndpoints { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._get(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { + self._listBySyncGroup(resourceGroupName, storageSyncServiceName, syncGroupName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._get(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, optionalCallback); + return self._listBySyncGroup(resourceGroupName, storageSyncServiceName, syncGroupName, options, optionalCallback); } } /** - * Delete a given ServerEndpoint. + * Recall a serverendpoint. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -1688,11 +2275,11 @@ class ServerEndpoints { * * @reject {Error} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options) { + recallWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._deleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { + self._recall(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1703,7 +2290,7 @@ class ServerEndpoints { } /** - * Delete a given ServerEndpoint. + * Recall a serverendpoint. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -1741,7 +2328,7 @@ class ServerEndpoints { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, optionalCallback) { + recall(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -1750,14 +2337,14 @@ class ServerEndpoints { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._deleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { + self._recall(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._deleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, optionalCallback); + return self._recall(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, optionalCallback); } } @@ -2250,6 +2837,103 @@ class ServerEndpoints { } } + /** + * Recall a serverendpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + beginRecallWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginRecall(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Recall a serverendpoint. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} syncGroupName Name of Sync Group resource. + * + * @param {string} serverEndpointName Name of Server Endpoint object. + * + * @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. + */ + beginRecall(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, 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._beginRecall(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginRecall(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, optionalCallback); + } + } + } module.exports = ServerEndpoints; diff --git a/lib/services/storagesyncManagement/lib/operations/storageSyncServices.js b/lib/services/storagesyncManagement/lib/operations/storageSyncServices.js index dcde786798..2578b3559d 100644 --- a/lib/services/storagesyncManagement/lib/operations/storageSyncServices.js +++ b/lib/services/storagesyncManagement/lib/operations/storageSyncServices.js @@ -160,7 +160,7 @@ function _create(resourceGroupName, storageSyncServiceName, body, options, callb error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['ErrorModel']().mapper(); + let resultMapper = new client.models['StorageSyncError']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -322,7 +322,7 @@ function _get(resourceGroupName, storageSyncServiceName, options, callback) { error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['ErrorModel']().mapper(); + let resultMapper = new client.models['StorageSyncError']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -501,7 +501,7 @@ function _update(resourceGroupName, storageSyncServiceName, options, callback) { error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['ErrorModel']().mapper(); + let resultMapper = new client.models['StorageSyncError']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -662,7 +662,7 @@ function _deleteMethod(resourceGroupName, storageSyncServiceName, options, callb error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['ErrorModel']().mapper(); + let resultMapper = new client.models['StorageSyncError']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -680,11 +680,302 @@ function _deleteMethod(resourceGroupName, storageSyncServiceName, options, callb }); } +/** + * Get a StorageSyncService list by Resource group name. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @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 StorageSyncServiceArray} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByResourceGroup(resourceGroupName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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.StorageSync/storageSyncServices'; + 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) { + 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['StorageSyncError']().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['StorageSyncServiceArray']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Get a StorageSyncService list by subscription. + * + * @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 StorageSyncServiceArray} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listBySubscription(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // 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 (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.StorageSync/storageSyncServices'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + 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['StorageSyncError']().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['StorageSyncServiceArray']().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 StorageSyncServices. */ class StorageSyncServices { /** * Create a StorageSyncServices. - * @param {MicrosoftStorageSync} client Reference to the service client. + * @param {StorageSyncManagementClient} client Reference to the service client. */ constructor(client) { this.client = client; @@ -692,6 +983,8 @@ class StorageSyncServices { this._get = _get; this._update = _update; this._deleteMethod = _deleteMethod; + this._listByResourceGroup = _listByResourceGroup; + this._listBySubscription = _listBySubscription; } /** @@ -1061,6 +1354,170 @@ class StorageSyncServices { } } + /** + * Get a StorageSyncService list by Resource group name. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get a StorageSyncService list by Resource group name. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @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 {StorageSyncServiceArray} - 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 StorageSyncServiceArray} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroup(resourceGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroup(resourceGroupName, options, optionalCallback); + } + } + + /** + * Get a StorageSyncService list by subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listBySubscriptionWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listBySubscription(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get a StorageSyncService list by subscription. + * + * @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 {StorageSyncServiceArray} - 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 StorageSyncServiceArray} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listBySubscription(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listBySubscription(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listBySubscription(options, optionalCallback); + } + } + } module.exports = StorageSyncServices; diff --git a/lib/services/storagesyncManagement/lib/operations/syncGroups.js b/lib/services/storagesyncManagement/lib/operations/syncGroups.js index 526ab67714..9a3b76c9cd 100644 --- a/lib/services/storagesyncManagement/lib/operations/syncGroups.js +++ b/lib/services/storagesyncManagement/lib/operations/syncGroups.js @@ -14,6 +14,168 @@ const msRest = require('ms-rest'); const msRestAzure = require('ms-rest-azure'); const WebResource = msRest.WebResource; +/** + * Get a SyncGroup List. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link SyncGroupArray} 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 _listByStorageSyncService(resourceGroupName, storageSyncServiceName, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName 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.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + 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['StorageSyncError']().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['SyncGroupArray']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + /** * Create a new SyncGroup. * @@ -168,7 +330,7 @@ function _create(resourceGroupName, storageSyncServiceName, syncGroupName, body, error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['ErrorModel']().mapper(); + let resultMapper = new client.models['StorageSyncError']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -336,7 +498,7 @@ function _get(resourceGroupName, storageSyncServiceName, syncGroupName, options, error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['ErrorModel']().mapper(); + let resultMapper = new client.models['StorageSyncError']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -503,7 +665,7 @@ function _deleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['ErrorModel']().mapper(); + let resultMapper = new client.models['StorageSyncError']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -525,15 +687,106 @@ function _deleteMethod(resourceGroupName, storageSyncServiceName, syncGroupName, class SyncGroups { /** * Create a SyncGroups. - * @param {MicrosoftStorageSync} client Reference to the service client. + * @param {StorageSyncManagementClient} client Reference to the service client. */ constructor(client) { this.client = client; + this._listByStorageSyncService = _listByStorageSyncService; this._create = _create; this._get = _get; this._deleteMethod = _deleteMethod; } + /** + * Get a SyncGroup List. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByStorageSyncServiceWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByStorageSyncService(resourceGroupName, storageSyncServiceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get a SyncGroup List. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {SyncGroupArray} - 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 SyncGroupArray} 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. + */ + listByStorageSyncService(resourceGroupName, storageSyncServiceName, 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._listByStorageSyncService(resourceGroupName, storageSyncServiceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByStorageSyncService(resourceGroupName, storageSyncServiceName, options, optionalCallback); + } + } + /** * Create a new SyncGroup. * diff --git a/lib/services/storagesyncManagement/lib/operations/workflows.js b/lib/services/storagesyncManagement/lib/operations/workflows.js index ac3d5a6915..7786329153 100644 --- a/lib/services/storagesyncManagement/lib/operations/workflows.js +++ b/lib/services/storagesyncManagement/lib/operations/workflows.js @@ -147,7 +147,7 @@ function _get(resourceGroupName, storageSyncServiceName, workflowId, options, ca error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['ErrorModel']().mapper(); + let resultMapper = new client.models['StorageSyncError']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -182,15 +182,166 @@ function _get(resourceGroupName, storageSyncServiceName, workflowId, options, ca }); } +/** + * Abort the given workflow. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} workflowId workflow Id + * + * @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 _abort(resourceGroupName, storageSyncServiceName, workflowId, 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + 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 (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { + throw new Error('storageSyncServiceName cannot be null or undefined and it must be of type string.'); + } + if (workflowId === null || workflowId === undefined || typeof workflowId.valueOf() !== 'string') { + throw new Error('workflowId 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.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows/{workflowId}/abort'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{storageSyncServiceName}', encodeURIComponent(storageSyncServiceName)); + requestUrl = requestUrl.replace('{workflowId}', encodeURIComponent(workflowId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['StorageSyncError']().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 Workflows. */ class Workflows { /** * Create a Workflows. - * @param {MicrosoftStorageSync} client Reference to the service client. + * @param {StorageSyncManagementClient} client Reference to the service client. */ constructor(client) { this.client = client; this._get = _get; + this._abort = _abort; } /** @@ -287,6 +438,99 @@ class Workflows { } } + /** + * Abort the given workflow. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} workflowId workflow Id + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + abortWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, workflowId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._abort(resourceGroupName, storageSyncServiceName, workflowId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Abort the given workflow. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} storageSyncServiceName Name of Storage Sync Service + * resource. + * + * @param {string} workflowId workflow Id + * + * @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. + */ + abort(resourceGroupName, storageSyncServiceName, workflowId, 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._abort(resourceGroupName, storageSyncServiceName, workflowId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._abort(resourceGroupName, storageSyncServiceName, workflowId, options, optionalCallback); + } + } + } module.exports = Workflows; diff --git a/lib/services/storagesyncManagement/lib/storageSyncManagementClient.d.ts b/lib/services/storagesyncManagement/lib/storageSyncManagementClient.d.ts new file mode 100644 index 0000000000..89f26b45c2 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/storageSyncManagementClient.d.ts @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import { ServiceClientCredentials } from 'ms-rest'; +import { AzureServiceClient, AzureServiceClientOptions } from 'ms-rest-azure'; +import * as models from "./models"; +import * as operations from "./operations"; + +export default class StorageSyncManagementClient extends AzureServiceClient { + /** + * Initializes a new instance of the StorageSyncManagementClient class. + * @constructor + * + * @class + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * + * @param {string} subscriptionId - Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * + * @param {string} [baseUri] - The base URI of the service. + * + * @param {object} [options] - The parameter options + * + * @param {Array} [options.filters] - Filters to be added to the request pipeline + * + * @param {object} [options.requestOptions] - Options for the underlying request object + * {@link https://github.com/request/request#requestoptions-callback Options doc} + * + * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy + * + * @param {string} [options.acceptLanguage] - 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. + * + */ + constructor(credentials: ServiceClientCredentials, subscriptionId: string, baseUri?: string, options?: AzureServiceClientOptions); + + credentials: ServiceClientCredentials; + + subscriptionId: string; + + apiVersion: string; + + acceptLanguage: string; + + longRunningOperationRetryTimeout: number; + + generateClientRequestId: boolean; + + // Operation groups + operations: operations.Operations; + storageSyncServices: operations.StorageSyncServices; + syncGroups: operations.SyncGroups; + cloudEndpoints: operations.CloudEndpoints; + serverEndpoints: operations.ServerEndpoints; + registeredServers: operations.RegisteredServers; + workflows: operations.Workflows; +} + +export { StorageSyncManagementClient, models as StorageSyncManagementModels }; diff --git a/lib/services/storagesyncManagement/lib/storageSyncManagementClient.js b/lib/services/storagesyncManagement/lib/storageSyncManagementClient.js new file mode 100644 index 0000000000..43d148eb6e --- /dev/null +++ b/lib/services/storagesyncManagement/lib/storageSyncManagementClient.js @@ -0,0 +1,91 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const ServiceClient = msRestAzure.AzureServiceClient; + +const models = require('./models'); +const operations = require('./operations'); + + +/** Class representing a StorageSyncManagementClient. */ +class StorageSyncManagementClient extends ServiceClient { + /** + * Create a StorageSyncManagementClient. + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * @param {string} subscriptionId - Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * @param {string} [baseUri] - The base URI of the service. + * @param {object} [options] - The parameter options + * @param {Array} [options.filters] - Filters to be added to the request pipeline + * @param {object} [options.requestOptions] - Options for the underlying request object + * {@link https://github.com/request/request#requestoptions-callback Options doc} + * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy + * @param {string} [options.acceptLanguage] - 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. + */ + constructor(credentials, subscriptionId, baseUri, options) { + if (credentials === null || credentials === undefined) { + throw new Error('\'credentials\' cannot be null.'); + } + if (subscriptionId === null || subscriptionId === undefined) { + throw new Error('\'subscriptionId\' cannot be null.'); + } + + if (!options) options = {}; + + super(credentials, options); + + this.apiVersion = '2017-06-05-preview'; + this.acceptLanguage = 'en-US'; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.baseUri = baseUri; + if (!this.baseUri) { + this.baseUri = 'https://azure.microsoft.com'; + } + this.credentials = credentials; + this.subscriptionId = subscriptionId; + + let packageInfo = this.getPackageJsonInfo(__dirname); + this.addUserAgentInfo(`${packageInfo.name}/${packageInfo.version}`); + if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { + this.acceptLanguage = options.acceptLanguage; + } + if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { + this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; + } + if(options.generateClientRequestId !== null && options.generateClientRequestId !== undefined) { + this.generateClientRequestId = options.generateClientRequestId; + } + this.operations = new operations.Operations(this); + this.storageSyncServices = new operations.StorageSyncServices(this); + this.syncGroups = new operations.SyncGroups(this); + this.cloudEndpoints = new operations.CloudEndpoints(this); + this.serverEndpoints = new operations.ServerEndpoints(this); + this.registeredServers = new operations.RegisteredServers(this); + this.workflows = new operations.Workflows(this); + this.models = models; + msRest.addSerializationMixin(this); + } + +} + +module.exports = StorageSyncManagementClient; +module.exports['default'] = StorageSyncManagementClient; +module.exports.StorageSyncManagementClient = StorageSyncManagementClient; +module.exports.StorageSyncManagementModels = models; diff --git a/lib/services/storagesyncManagement/package.json b/lib/services/storagesyncManagement/package.json index 399c32cbe8..c158f40b5e 100644 --- a/lib/services/storagesyncManagement/package.json +++ b/lib/services/storagesyncManagement/package.json @@ -1,7 +1,7 @@ { "name": "azure-arm-storagesync", "author": "Microsoft Corporation", - "description": "MicrosoftStorageSync Library with typescript type definitions for node", + "description": "StorageSyncManagementClient Library with typescript type definitions for node", "version": "1.0.0", "dependencies": { "ms-rest": "^2.3.3", @@ -12,8 +12,8 @@ "azure" ], "license": "MIT", - "main": "./lib/microsoftStorageSync.js", - "types": "./lib/microsoftStorageSync.d.ts", + "main": "./lib/storageSyncManagementClient.js", + "types": "./lib/storageSyncManagementClient.d.ts", "homepage": "http://github.com/azure/azure-sdk-for-node", "repository": { "type": "git", From efc1a6752a1f8a900aa143791b84821e3dd63978 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 12 Jun 2018 22:39:49 +0000 Subject: [PATCH 3/3] Generated from dd8124f88a1bebfa7dbca3e881781b3c5ef82028 body to parameters body to parameters --- .../lib/operations/cloudEndpoints.js | 678 ++++++----- .../lib/operations/index.d.ts | 1058 +++++++++-------- .../lib/operations/registeredServers.js | 204 ++-- .../lib/operations/serverEndpoints.js | 722 +++++------ .../lib/operations/storageSyncServices.js | 42 +- .../lib/operations/syncGroups.js | 34 +- 6 files changed, 1449 insertions(+), 1289 deletions(-) diff --git a/lib/services/storagesyncManagement/lib/operations/cloudEndpoints.js b/lib/services/storagesyncManagement/lib/operations/cloudEndpoints.js index e6ce9ccc6c..99dc355613 100644 --- a/lib/services/storagesyncManagement/lib/operations/cloudEndpoints.js +++ b/lib/services/storagesyncManagement/lib/operations/cloudEndpoints.js @@ -28,25 +28,29 @@ const WebResource = msRest.WebResource; * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Cloud Endpoint resource. + * @param {object} parameters Body of Cloud Endpoint resource. * - * @param {string} [body.storageAccountKey] Storage Account access key. + * @param {string} [parameters.storageAccountKey] Storage Account access key. * - * @param {string} [body.storageAccount] Storage Account name. + * @param {string} [parameters.storageAccount] Storage Account name. * - * @param {string} [body.storageAccountResourceId] Storage Account Resource Id + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id * - * @param {string} [body.storageAccountShareName] Storage Account Share name + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name * - * @param {string} [body.storageAccountTenantId] Storage Account Tenant Id + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id * - * @param {string} [body.partnershipId] Partnership Id + * @param {string} [parameters.partnershipId] Partnership Id * - * @param {string} [body.friendlyName] Friendly Name + * @param {string} [parameters.friendlyName] Friendly Name * - * @param {string} [body.provisioningState] CloudEndpoint Provisioning State + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State * - * @param {string} [body.lastWorkflowId] CloudEndpoint lastWorkflowId + * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId * * @param {object} [options] Optional Parameters. * @@ -66,7 +70,7 @@ const WebResource = msRest.WebResource; * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _create(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, callback) { +function _create(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -79,7 +83,7 @@ function _create(resourceGroupName, storageSyncServiceName, syncGroupName, cloud } // Send request - this.beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, parsedResult, httpRequest, response) => { + this.beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, parsedResult, httpRequest, response) => { if (err) return callback(err); let initialResult = new msRest.HttpOperationResponse(); @@ -543,9 +547,9 @@ function _listBySyncGroup(resourceGroupName, storageSyncServiceName, syncGroupNa * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Backup request. + * @param {object} parameters Body of Backup request. * - * @param {string} [body.azureFileShare] Azure File Share. + * @param {string} [parameters.azureFileShare] Azure File Share. * * @param {object} [options] Optional Parameters. * @@ -564,7 +568,7 @@ function _listBySyncGroup(resourceGroupName, storageSyncServiceName, syncGroupNa * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _preBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, callback) { +function _preBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -577,7 +581,7 @@ function _preBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cl } // Send request - this.beginPreBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, parsedResult, httpRequest, response) => { + this.beginPreBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, parsedResult, httpRequest, response) => { if (err) return callback(err); let initialResult = new msRest.HttpOperationResponse(); @@ -616,9 +620,9 @@ function _preBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cl * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Backup request. + * @param {object} parameters Body of Backup request. * - * @param {string} [body.azureFileShare] Azure File Share. + * @param {string} [parameters.azureFileShare] Azure File Share. * * @param {object} [options] Optional Parameters. * @@ -638,7 +642,7 @@ function _preBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cl * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _postBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, callback) { +function _postBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -651,7 +655,7 @@ function _postBackup(resourceGroupName, storageSyncServiceName, syncGroupName, c } // Send request - this.beginPostBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, parsedResult, httpRequest, response) => { + this.beginPostBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, parsedResult, httpRequest, response) => { if (err) return callback(err); let initialResult = new msRest.HttpOperationResponse(); @@ -704,28 +708,30 @@ function _postBackup(resourceGroupName, storageSyncServiceName, syncGroupName, c * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Cloud Endpoint object. + * @param {object} parameters Body of Cloud Endpoint object. * - * @param {string} [body.partition] Pre Restore partition. + * @param {string} [parameters.partition] Pre Restore partition. * - * @param {string} [body.replicaGroup] Pre Restore replica group. + * @param {string} [parameters.replicaGroup] Pre Restore replica group. * - * @param {string} [body.requestId] Pre Restore request id. + * @param {string} [parameters.requestId] Pre Restore request id. * - * @param {string} [body.azureFileShareUri] Pre Restore Azure file share uri. + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. * - * @param {string} [body.status] Pre Restore Azure status. + * @param {string} [parameters.status] Pre Restore Azure status. * - * @param {string} [body.sourceAzureFileShareUri] Pre Restore Azure source - * azure file share uri. + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. * - * @param {string} [body.backupMetadataPropertyBag] Pre Restore backup metadata - * property bag. + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. * - * @param {array} [body.restoreFileSpec] Pre Restore restore file spec array. + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. * - * @param {number} [body.pauseWaitForSyncDrainTimePeriodInSeconds] Pre Restore - * pause wait for sync drain time period in seconds. + * @param {number} [parameters.pauseWaitForSyncDrainTimePeriodInSeconds] Pre + * Restore pause wait for sync drain time period in seconds. * * @param {object} [options] Optional Parameters. * @@ -744,7 +750,7 @@ function _postBackup(resourceGroupName, storageSyncServiceName, syncGroupName, c * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _preRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, callback) { +function _preRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -757,7 +763,7 @@ function _preRestore(resourceGroupName, storageSyncServiceName, syncGroupName, c } // Send request - this.beginPreRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, parsedResult, httpRequest, response) => { + this.beginPreRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, parsedResult, httpRequest, response) => { if (err) return callback(err); let initialResult = new msRest.HttpOperationResponse(); @@ -952,24 +958,27 @@ function _restoreHeatbeat(resourceGroupName, storageSyncServiceName, syncGroupNa * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Cloud Endpoint object. + * @param {object} parameters Body of Cloud Endpoint object. * - * @param {string} [body.partition] Post Restore partition. + * @param {string} [parameters.partition] Post Restore partition. * - * @param {string} [body.replicaGroup] Post Restore replica group. + * @param {string} [parameters.replicaGroup] Post Restore replica group. * - * @param {string} [body.requestId] Post Restore request id. + * @param {string} [parameters.requestId] Post Restore request id. * - * @param {string} [body.azureFileShareUri] Post Restore Azure file share uri. + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. * - * @param {string} [body.status] Post Restore Azure status. + * @param {string} [parameters.status] Post Restore Azure status. * - * @param {string} [body.sourceAzureFileShareUri] Post Restore Azure source - * azure file share uri. + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. * - * @param {string} [body.failedFileList] Post Restore Azure failed file list. + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. * - * @param {array} [body.restoreFileSpec] Post Restore restore file spec array. + * @param {array} [parameters.restoreFileSpec] Post Restore restore file spec + * array. * * @param {object} [options] Optional Parameters. * @@ -988,7 +997,7 @@ function _restoreHeatbeat(resourceGroupName, storageSyncServiceName, syncGroupNa * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _postRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, callback) { +function _postRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -1001,7 +1010,7 @@ function _postRestore(resourceGroupName, storageSyncServiceName, syncGroupName, } // Send request - this.beginPostRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, parsedResult, httpRequest, response) => { + this.beginPostRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, parsedResult, httpRequest, response) => { if (err) return callback(err); let initialResult = new msRest.HttpOperationResponse(); @@ -1039,25 +1048,29 @@ function _postRestore(resourceGroupName, storageSyncServiceName, syncGroupName, * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Cloud Endpoint resource. + * @param {object} parameters Body of Cloud Endpoint resource. * - * @param {string} [body.storageAccountKey] Storage Account access key. + * @param {string} [parameters.storageAccountKey] Storage Account access key. * - * @param {string} [body.storageAccount] Storage Account name. + * @param {string} [parameters.storageAccount] Storage Account name. * - * @param {string} [body.storageAccountResourceId] Storage Account Resource Id + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id * - * @param {string} [body.storageAccountShareName] Storage Account Share name + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name * - * @param {string} [body.storageAccountTenantId] Storage Account Tenant Id + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id * - * @param {string} [body.partnershipId] Partnership Id + * @param {string} [parameters.partnershipId] Partnership Id * - * @param {string} [body.friendlyName] Friendly Name + * @param {string} [parameters.friendlyName] Friendly Name * - * @param {string} [body.provisioningState] CloudEndpoint Provisioning State + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State * - * @param {string} [body.lastWorkflowId] CloudEndpoint lastWorkflowId + * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId * * @param {object} [options] Optional Parameters. * @@ -1077,7 +1090,7 @@ function _postRestore(resourceGroupName, storageSyncServiceName, syncGroupName, * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, callback) { +function _beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -1121,8 +1134,8 @@ function _beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, if (cloudEndpointName === null || cloudEndpointName === undefined || typeof cloudEndpointName.valueOf() !== 'string') { throw new Error('cloudEndpointName cannot be null or undefined and it must be of type string.'); } - if (body === null || body === undefined) { - throw new Error('body cannot be null or undefined.'); + 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.'); @@ -1169,14 +1182,14 @@ function _beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, let requestContent = null; let requestModel = null; try { - if (body !== null && body !== undefined) { + if (parameters !== null && parameters !== undefined) { let requestModelMapper = new client.models['CloudEndpoint']().mapper(); - requestModel = client.serialize(requestModelMapper, body, 'body'); + 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(body, null, 2)}.`); + `payload - ${JSON.stringify(parameters, null, 2)}.`); return callback(serializationError); } httpRequest.body = requestContent; @@ -1406,9 +1419,9 @@ function _beginDeleteMethod(resourceGroupName, storageSyncServiceName, syncGroup * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Backup request. + * @param {object} parameters Body of Backup request. * - * @param {string} [body.azureFileShare] Azure File Share. + * @param {string} [parameters.azureFileShare] Azure File Share. * * @param {object} [options] Optional Parameters. * @@ -1427,7 +1440,7 @@ function _beginDeleteMethod(resourceGroupName, storageSyncServiceName, syncGroup * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _beginPreBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, callback) { +function _beginPreBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -1471,8 +1484,8 @@ function _beginPreBackup(resourceGroupName, storageSyncServiceName, syncGroupNam if (cloudEndpointName === null || cloudEndpointName === undefined || typeof cloudEndpointName.valueOf() !== 'string') { throw new Error('cloudEndpointName cannot be null or undefined and it must be of type string.'); } - if (body === null || body === undefined) { - throw new Error('body cannot be null or undefined.'); + 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.'); @@ -1519,14 +1532,14 @@ function _beginPreBackup(resourceGroupName, storageSyncServiceName, syncGroupNam let requestContent = null; let requestModel = null; try { - if (body !== null && body !== undefined) { + if (parameters !== null && parameters !== undefined) { let requestModelMapper = new client.models['BackupRequest']().mapper(); - requestModel = client.serialize(requestModelMapper, body, 'body'); + 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(body, null, 2)}.`); + `payload - ${JSON.stringify(parameters, null, 2)}.`); return callback(serializationError); } httpRequest.body = requestContent; @@ -1583,9 +1596,9 @@ function _beginPreBackup(resourceGroupName, storageSyncServiceName, syncGroupNam * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Backup request. + * @param {object} parameters Body of Backup request. * - * @param {string} [body.azureFileShare] Azure File Share. + * @param {string} [parameters.azureFileShare] Azure File Share. * * @param {object} [options] Optional Parameters. * @@ -1605,7 +1618,7 @@ function _beginPreBackup(resourceGroupName, storageSyncServiceName, syncGroupNam * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _beginPostBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, callback) { +function _beginPostBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -1649,8 +1662,8 @@ function _beginPostBackup(resourceGroupName, storageSyncServiceName, syncGroupNa if (cloudEndpointName === null || cloudEndpointName === undefined || typeof cloudEndpointName.valueOf() !== 'string') { throw new Error('cloudEndpointName cannot be null or undefined and it must be of type string.'); } - if (body === null || body === undefined) { - throw new Error('body cannot be null or undefined.'); + 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.'); @@ -1697,14 +1710,14 @@ function _beginPostBackup(resourceGroupName, storageSyncServiceName, syncGroupNa let requestContent = null; let requestModel = null; try { - if (body !== null && body !== undefined) { + if (parameters !== null && parameters !== undefined) { let requestModelMapper = new client.models['BackupRequest']().mapper(); - requestModel = client.serialize(requestModelMapper, body, 'body'); + 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(body, null, 2)}.`); + `payload - ${JSON.stringify(parameters, null, 2)}.`); return callback(serializationError); } httpRequest.body = requestContent; @@ -1778,28 +1791,30 @@ function _beginPostBackup(resourceGroupName, storageSyncServiceName, syncGroupNa * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Cloud Endpoint object. + * @param {object} parameters Body of Cloud Endpoint object. * - * @param {string} [body.partition] Pre Restore partition. + * @param {string} [parameters.partition] Pre Restore partition. * - * @param {string} [body.replicaGroup] Pre Restore replica group. + * @param {string} [parameters.replicaGroup] Pre Restore replica group. * - * @param {string} [body.requestId] Pre Restore request id. + * @param {string} [parameters.requestId] Pre Restore request id. * - * @param {string} [body.azureFileShareUri] Pre Restore Azure file share uri. + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. * - * @param {string} [body.status] Pre Restore Azure status. + * @param {string} [parameters.status] Pre Restore Azure status. * - * @param {string} [body.sourceAzureFileShareUri] Pre Restore Azure source - * azure file share uri. + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. * - * @param {string} [body.backupMetadataPropertyBag] Pre Restore backup metadata - * property bag. + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. * - * @param {array} [body.restoreFileSpec] Pre Restore restore file spec array. + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. * - * @param {number} [body.pauseWaitForSyncDrainTimePeriodInSeconds] Pre Restore - * pause wait for sync drain time period in seconds. + * @param {number} [parameters.pauseWaitForSyncDrainTimePeriodInSeconds] Pre + * Restore pause wait for sync drain time period in seconds. * * @param {object} [options] Optional Parameters. * @@ -1818,7 +1833,7 @@ function _beginPostBackup(resourceGroupName, storageSyncServiceName, syncGroupNa * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _beginPreRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, callback) { +function _beginPreRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -1862,8 +1877,8 @@ function _beginPreRestore(resourceGroupName, storageSyncServiceName, syncGroupNa if (cloudEndpointName === null || cloudEndpointName === undefined || typeof cloudEndpointName.valueOf() !== 'string') { throw new Error('cloudEndpointName cannot be null or undefined and it must be of type string.'); } - if (body === null || body === undefined) { - throw new Error('body cannot be null or undefined.'); + 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.'); @@ -1910,14 +1925,14 @@ function _beginPreRestore(resourceGroupName, storageSyncServiceName, syncGroupNa let requestContent = null; let requestModel = null; try { - if (body !== null && body !== undefined) { + if (parameters !== null && parameters !== undefined) { let requestModelMapper = new client.models['PreRestoreRequest']().mapper(); - requestModel = client.serialize(requestModelMapper, body, 'body'); + 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(body, null, 2)}.`); + `payload - ${JSON.stringify(parameters, null, 2)}.`); return callback(serializationError); } httpRequest.body = requestContent; @@ -1974,24 +1989,27 @@ function _beginPreRestore(resourceGroupName, storageSyncServiceName, syncGroupNa * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Cloud Endpoint object. + * @param {object} parameters Body of Cloud Endpoint object. * - * @param {string} [body.partition] Post Restore partition. + * @param {string} [parameters.partition] Post Restore partition. * - * @param {string} [body.replicaGroup] Post Restore replica group. + * @param {string} [parameters.replicaGroup] Post Restore replica group. * - * @param {string} [body.requestId] Post Restore request id. + * @param {string} [parameters.requestId] Post Restore request id. * - * @param {string} [body.azureFileShareUri] Post Restore Azure file share uri. + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. * - * @param {string} [body.status] Post Restore Azure status. + * @param {string} [parameters.status] Post Restore Azure status. * - * @param {string} [body.sourceAzureFileShareUri] Post Restore Azure source - * azure file share uri. + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. * - * @param {string} [body.failedFileList] Post Restore Azure failed file list. + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. * - * @param {array} [body.restoreFileSpec] Post Restore restore file spec array. + * @param {array} [parameters.restoreFileSpec] Post Restore restore file spec + * array. * * @param {object} [options] Optional Parameters. * @@ -2010,7 +2028,7 @@ function _beginPreRestore(resourceGroupName, storageSyncServiceName, syncGroupNa * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _beginPostRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, callback) { +function _beginPostRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -2054,8 +2072,8 @@ function _beginPostRestore(resourceGroupName, storageSyncServiceName, syncGroupN if (cloudEndpointName === null || cloudEndpointName === undefined || typeof cloudEndpointName.valueOf() !== 'string') { throw new Error('cloudEndpointName cannot be null or undefined and it must be of type string.'); } - if (body === null || body === undefined) { - throw new Error('body cannot be null or undefined.'); + 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.'); @@ -2102,14 +2120,14 @@ function _beginPostRestore(resourceGroupName, storageSyncServiceName, syncGroupN let requestContent = null; let requestModel = null; try { - if (body !== null && body !== undefined) { + if (parameters !== null && parameters !== undefined) { let requestModelMapper = new client.models['PostRestoreRequest']().mapper(); - requestModel = client.serialize(requestModelMapper, body, 'body'); + 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(body, null, 2)}.`); + `payload - ${JSON.stringify(parameters, null, 2)}.`); return callback(serializationError); } httpRequest.body = requestContent; @@ -2191,25 +2209,29 @@ class CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Cloud Endpoint resource. + * @param {object} parameters Body of Cloud Endpoint resource. * - * @param {string} [body.storageAccountKey] Storage Account access key. + * @param {string} [parameters.storageAccountKey] Storage Account access key. * - * @param {string} [body.storageAccount] Storage Account name. + * @param {string} [parameters.storageAccount] Storage Account name. * - * @param {string} [body.storageAccountResourceId] Storage Account Resource Id + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id * - * @param {string} [body.storageAccountShareName] Storage Account Share name + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name * - * @param {string} [body.storageAccountTenantId] Storage Account Tenant Id + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id * - * @param {string} [body.partnershipId] Partnership Id + * @param {string} [parameters.partnershipId] Partnership Id * - * @param {string} [body.friendlyName] Friendly Name + * @param {string} [parameters.friendlyName] Friendly Name * - * @param {string} [body.provisioningState] CloudEndpoint Provisioning State + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State * - * @param {string} [body.lastWorkflowId] CloudEndpoint lastWorkflowId + * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId * * @param {object} [options] Optional Parameters. * @@ -2222,11 +2244,11 @@ class CloudEndpoints { * * @reject {Error} - The error object. */ - createWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options) { + createWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._create(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + self._create(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -2249,25 +2271,29 @@ class CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Cloud Endpoint resource. + * @param {object} parameters Body of Cloud Endpoint resource. * - * @param {string} [body.storageAccountKey] Storage Account access key. + * @param {string} [parameters.storageAccountKey] Storage Account access key. * - * @param {string} [body.storageAccount] Storage Account name. + * @param {string} [parameters.storageAccount] Storage Account name. * - * @param {string} [body.storageAccountResourceId] Storage Account Resource Id + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id * - * @param {string} [body.storageAccountShareName] Storage Account Share name + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name * - * @param {string} [body.storageAccountTenantId] Storage Account Tenant Id + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id * - * @param {string} [body.partnershipId] Partnership Id + * @param {string} [parameters.partnershipId] Partnership Id * - * @param {string} [body.friendlyName] Friendly Name + * @param {string} [parameters.friendlyName] Friendly Name * - * @param {string} [body.provisioningState] CloudEndpoint Provisioning State + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State * - * @param {string} [body.lastWorkflowId] CloudEndpoint lastWorkflowId + * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId * * @param {object} [options] Optional Parameters. * @@ -2296,7 +2322,7 @@ class CloudEndpoints { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - create(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback) { + create(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -2305,14 +2331,14 @@ class CloudEndpoints { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._create(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + self._create(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._create(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback); + return self._create(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, optionalCallback); } } @@ -2618,9 +2644,9 @@ class CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Backup request. + * @param {object} parameters Body of Backup request. * - * @param {string} [body.azureFileShare] Azure File Share. + * @param {string} [parameters.azureFileShare] Azure File Share. * * @param {object} [options] Optional Parameters. * @@ -2633,11 +2659,11 @@ class CloudEndpoints { * * @reject {Error} - The error object. */ - preBackupWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options) { + preBackupWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._preBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + self._preBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -2660,9 +2686,9 @@ class CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Backup request. + * @param {object} parameters Body of Backup request. * - * @param {string} [body.azureFileShare] Azure File Share. + * @param {string} [parameters.azureFileShare] Azure File Share. * * @param {object} [options] Optional Parameters. * @@ -2690,7 +2716,7 @@ class CloudEndpoints { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - preBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback) { + preBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -2699,14 +2725,14 @@ class CloudEndpoints { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._preBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + self._preBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._preBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback); + return self._preBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, optionalCallback); } } @@ -2723,9 +2749,9 @@ class CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Backup request. + * @param {object} parameters Body of Backup request. * - * @param {string} [body.azureFileShare] Azure File Share. + * @param {string} [parameters.azureFileShare] Azure File Share. * * @param {object} [options] Optional Parameters. * @@ -2738,11 +2764,11 @@ class CloudEndpoints { * * @reject {Error} - The error object. */ - postBackupWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options) { + postBackupWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._postBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + self._postBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -2765,9 +2791,9 @@ class CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Backup request. + * @param {object} parameters Body of Backup request. * - * @param {string} [body.azureFileShare] Azure File Share. + * @param {string} [parameters.azureFileShare] Azure File Share. * * @param {object} [options] Optional Parameters. * @@ -2796,7 +2822,7 @@ class CloudEndpoints { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - postBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback) { + postBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -2805,14 +2831,14 @@ class CloudEndpoints { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._postBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + self._postBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._postBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback); + return self._postBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, optionalCallback); } } @@ -2829,28 +2855,30 @@ class CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Cloud Endpoint object. + * @param {object} parameters Body of Cloud Endpoint object. * - * @param {string} [body.partition] Pre Restore partition. + * @param {string} [parameters.partition] Pre Restore partition. * - * @param {string} [body.replicaGroup] Pre Restore replica group. + * @param {string} [parameters.replicaGroup] Pre Restore replica group. * - * @param {string} [body.requestId] Pre Restore request id. + * @param {string} [parameters.requestId] Pre Restore request id. * - * @param {string} [body.azureFileShareUri] Pre Restore Azure file share uri. + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. * - * @param {string} [body.status] Pre Restore Azure status. + * @param {string} [parameters.status] Pre Restore Azure status. * - * @param {string} [body.sourceAzureFileShareUri] Pre Restore Azure source - * azure file share uri. + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. * - * @param {string} [body.backupMetadataPropertyBag] Pre Restore backup metadata - * property bag. + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. * - * @param {array} [body.restoreFileSpec] Pre Restore restore file spec array. + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. * - * @param {number} [body.pauseWaitForSyncDrainTimePeriodInSeconds] Pre Restore - * pause wait for sync drain time period in seconds. + * @param {number} [parameters.pauseWaitForSyncDrainTimePeriodInSeconds] Pre + * Restore pause wait for sync drain time period in seconds. * * @param {object} [options] Optional Parameters. * @@ -2863,11 +2891,11 @@ class CloudEndpoints { * * @reject {Error} - The error object. */ - preRestoreWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options) { + preRestoreWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._preRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + self._preRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -2890,28 +2918,30 @@ class CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Cloud Endpoint object. + * @param {object} parameters Body of Cloud Endpoint object. * - * @param {string} [body.partition] Pre Restore partition. + * @param {string} [parameters.partition] Pre Restore partition. * - * @param {string} [body.replicaGroup] Pre Restore replica group. + * @param {string} [parameters.replicaGroup] Pre Restore replica group. * - * @param {string} [body.requestId] Pre Restore request id. + * @param {string} [parameters.requestId] Pre Restore request id. * - * @param {string} [body.azureFileShareUri] Pre Restore Azure file share uri. + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. * - * @param {string} [body.status] Pre Restore Azure status. + * @param {string} [parameters.status] Pre Restore Azure status. * - * @param {string} [body.sourceAzureFileShareUri] Pre Restore Azure source - * azure file share uri. + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. * - * @param {string} [body.backupMetadataPropertyBag] Pre Restore backup metadata - * property bag. + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. * - * @param {array} [body.restoreFileSpec] Pre Restore restore file spec array. + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. * - * @param {number} [body.pauseWaitForSyncDrainTimePeriodInSeconds] Pre Restore - * pause wait for sync drain time period in seconds. + * @param {number} [parameters.pauseWaitForSyncDrainTimePeriodInSeconds] Pre + * Restore pause wait for sync drain time period in seconds. * * @param {object} [options] Optional Parameters. * @@ -2939,7 +2969,7 @@ class CloudEndpoints { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - preRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback) { + preRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -2948,14 +2978,14 @@ class CloudEndpoints { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._preRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + self._preRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._preRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback); + return self._preRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, optionalCallback); } } @@ -3069,24 +3099,27 @@ class CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Cloud Endpoint object. + * @param {object} parameters Body of Cloud Endpoint object. * - * @param {string} [body.partition] Post Restore partition. + * @param {string} [parameters.partition] Post Restore partition. * - * @param {string} [body.replicaGroup] Post Restore replica group. + * @param {string} [parameters.replicaGroup] Post Restore replica group. * - * @param {string} [body.requestId] Post Restore request id. + * @param {string} [parameters.requestId] Post Restore request id. * - * @param {string} [body.azureFileShareUri] Post Restore Azure file share uri. + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. * - * @param {string} [body.status] Post Restore Azure status. + * @param {string} [parameters.status] Post Restore Azure status. * - * @param {string} [body.sourceAzureFileShareUri] Post Restore Azure source - * azure file share uri. + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. * - * @param {string} [body.failedFileList] Post Restore Azure failed file list. + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. * - * @param {array} [body.restoreFileSpec] Post Restore restore file spec array. + * @param {array} [parameters.restoreFileSpec] Post Restore restore file spec + * array. * * @param {object} [options] Optional Parameters. * @@ -3099,11 +3132,11 @@ class CloudEndpoints { * * @reject {Error} - The error object. */ - postRestoreWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options) { + postRestoreWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._postRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + self._postRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -3126,24 +3159,27 @@ class CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Cloud Endpoint object. + * @param {object} parameters Body of Cloud Endpoint object. * - * @param {string} [body.partition] Post Restore partition. + * @param {string} [parameters.partition] Post Restore partition. * - * @param {string} [body.replicaGroup] Post Restore replica group. + * @param {string} [parameters.replicaGroup] Post Restore replica group. * - * @param {string} [body.requestId] Post Restore request id. + * @param {string} [parameters.requestId] Post Restore request id. * - * @param {string} [body.azureFileShareUri] Post Restore Azure file share uri. + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. * - * @param {string} [body.status] Post Restore Azure status. + * @param {string} [parameters.status] Post Restore Azure status. * - * @param {string} [body.sourceAzureFileShareUri] Post Restore Azure source - * azure file share uri. + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. * - * @param {string} [body.failedFileList] Post Restore Azure failed file list. + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. * - * @param {array} [body.restoreFileSpec] Post Restore restore file spec array. + * @param {array} [parameters.restoreFileSpec] Post Restore restore file spec + * array. * * @param {object} [options] Optional Parameters. * @@ -3171,7 +3207,7 @@ class CloudEndpoints { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - postRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback) { + postRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -3180,14 +3216,14 @@ class CloudEndpoints { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._postRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + self._postRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._postRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback); + return self._postRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, optionalCallback); } } @@ -3204,25 +3240,29 @@ class CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Cloud Endpoint resource. + * @param {object} parameters Body of Cloud Endpoint resource. * - * @param {string} [body.storageAccountKey] Storage Account access key. + * @param {string} [parameters.storageAccountKey] Storage Account access key. * - * @param {string} [body.storageAccount] Storage Account name. + * @param {string} [parameters.storageAccount] Storage Account name. * - * @param {string} [body.storageAccountResourceId] Storage Account Resource Id + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id * - * @param {string} [body.storageAccountShareName] Storage Account Share name + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name * - * @param {string} [body.storageAccountTenantId] Storage Account Tenant Id + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id * - * @param {string} [body.partnershipId] Partnership Id + * @param {string} [parameters.partnershipId] Partnership Id * - * @param {string} [body.friendlyName] Friendly Name + * @param {string} [parameters.friendlyName] Friendly Name * - * @param {string} [body.provisioningState] CloudEndpoint Provisioning State + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State * - * @param {string} [body.lastWorkflowId] CloudEndpoint lastWorkflowId + * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId * * @param {object} [options] Optional Parameters. * @@ -3235,11 +3275,11 @@ class CloudEndpoints { * * @reject {Error} - The error object. */ - beginCreateWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options) { + beginCreateWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + self._beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -3262,25 +3302,29 @@ class CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Cloud Endpoint resource. + * @param {object} parameters Body of Cloud Endpoint resource. * - * @param {string} [body.storageAccountKey] Storage Account access key. + * @param {string} [parameters.storageAccountKey] Storage Account access key. * - * @param {string} [body.storageAccount] Storage Account name. + * @param {string} [parameters.storageAccount] Storage Account name. * - * @param {string} [body.storageAccountResourceId] Storage Account Resource Id + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id * - * @param {string} [body.storageAccountShareName] Storage Account Share name + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name * - * @param {string} [body.storageAccountTenantId] Storage Account Tenant Id + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id * - * @param {string} [body.partnershipId] Partnership Id + * @param {string} [parameters.partnershipId] Partnership Id * - * @param {string} [body.friendlyName] Friendly Name + * @param {string} [parameters.friendlyName] Friendly Name * - * @param {string} [body.provisioningState] CloudEndpoint Provisioning State + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State * - * @param {string} [body.lastWorkflowId] CloudEndpoint lastWorkflowId + * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId * * @param {object} [options] Optional Parameters. * @@ -3309,7 +3353,7 @@ class CloudEndpoints { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback) { + beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -3318,14 +3362,14 @@ class CloudEndpoints { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + self._beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback); + return self._beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, optionalCallback); } } @@ -3439,9 +3483,9 @@ class CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Backup request. + * @param {object} parameters Body of Backup request. * - * @param {string} [body.azureFileShare] Azure File Share. + * @param {string} [parameters.azureFileShare] Azure File Share. * * @param {object} [options] Optional Parameters. * @@ -3454,11 +3498,11 @@ class CloudEndpoints { * * @reject {Error} - The error object. */ - beginPreBackupWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options) { + beginPreBackupWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._beginPreBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + self._beginPreBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -3481,9 +3525,9 @@ class CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Backup request. + * @param {object} parameters Body of Backup request. * - * @param {string} [body.azureFileShare] Azure File Share. + * @param {string} [parameters.azureFileShare] Azure File Share. * * @param {object} [options] Optional Parameters. * @@ -3511,7 +3555,7 @@ class CloudEndpoints { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - beginPreBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback) { + beginPreBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -3520,14 +3564,14 @@ class CloudEndpoints { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._beginPreBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + self._beginPreBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._beginPreBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback); + return self._beginPreBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, optionalCallback); } } @@ -3544,9 +3588,9 @@ class CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Backup request. + * @param {object} parameters Body of Backup request. * - * @param {string} [body.azureFileShare] Azure File Share. + * @param {string} [parameters.azureFileShare] Azure File Share. * * @param {object} [options] Optional Parameters. * @@ -3559,11 +3603,11 @@ class CloudEndpoints { * * @reject {Error} - The error object. */ - beginPostBackupWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options) { + beginPostBackupWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._beginPostBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + self._beginPostBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -3586,9 +3630,9 @@ class CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Backup request. + * @param {object} parameters Body of Backup request. * - * @param {string} [body.azureFileShare] Azure File Share. + * @param {string} [parameters.azureFileShare] Azure File Share. * * @param {object} [options] Optional Parameters. * @@ -3617,7 +3661,7 @@ class CloudEndpoints { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - beginPostBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback) { + beginPostBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -3626,14 +3670,14 @@ class CloudEndpoints { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._beginPostBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + self._beginPostBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._beginPostBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback); + return self._beginPostBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, optionalCallback); } } @@ -3650,28 +3694,30 @@ class CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Cloud Endpoint object. + * @param {object} parameters Body of Cloud Endpoint object. * - * @param {string} [body.partition] Pre Restore partition. + * @param {string} [parameters.partition] Pre Restore partition. * - * @param {string} [body.replicaGroup] Pre Restore replica group. + * @param {string} [parameters.replicaGroup] Pre Restore replica group. * - * @param {string} [body.requestId] Pre Restore request id. + * @param {string} [parameters.requestId] Pre Restore request id. * - * @param {string} [body.azureFileShareUri] Pre Restore Azure file share uri. + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. * - * @param {string} [body.status] Pre Restore Azure status. + * @param {string} [parameters.status] Pre Restore Azure status. * - * @param {string} [body.sourceAzureFileShareUri] Pre Restore Azure source - * azure file share uri. + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. * - * @param {string} [body.backupMetadataPropertyBag] Pre Restore backup metadata - * property bag. + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. * - * @param {array} [body.restoreFileSpec] Pre Restore restore file spec array. + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. * - * @param {number} [body.pauseWaitForSyncDrainTimePeriodInSeconds] Pre Restore - * pause wait for sync drain time period in seconds. + * @param {number} [parameters.pauseWaitForSyncDrainTimePeriodInSeconds] Pre + * Restore pause wait for sync drain time period in seconds. * * @param {object} [options] Optional Parameters. * @@ -3684,11 +3730,11 @@ class CloudEndpoints { * * @reject {Error} - The error object. */ - beginPreRestoreWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options) { + beginPreRestoreWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._beginPreRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + self._beginPreRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -3711,28 +3757,30 @@ class CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Cloud Endpoint object. + * @param {object} parameters Body of Cloud Endpoint object. * - * @param {string} [body.partition] Pre Restore partition. + * @param {string} [parameters.partition] Pre Restore partition. * - * @param {string} [body.replicaGroup] Pre Restore replica group. + * @param {string} [parameters.replicaGroup] Pre Restore replica group. * - * @param {string} [body.requestId] Pre Restore request id. + * @param {string} [parameters.requestId] Pre Restore request id. * - * @param {string} [body.azureFileShareUri] Pre Restore Azure file share uri. + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. * - * @param {string} [body.status] Pre Restore Azure status. + * @param {string} [parameters.status] Pre Restore Azure status. * - * @param {string} [body.sourceAzureFileShareUri] Pre Restore Azure source - * azure file share uri. + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. * - * @param {string} [body.backupMetadataPropertyBag] Pre Restore backup metadata - * property bag. + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. * - * @param {array} [body.restoreFileSpec] Pre Restore restore file spec array. + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. * - * @param {number} [body.pauseWaitForSyncDrainTimePeriodInSeconds] Pre Restore - * pause wait for sync drain time period in seconds. + * @param {number} [parameters.pauseWaitForSyncDrainTimePeriodInSeconds] Pre + * Restore pause wait for sync drain time period in seconds. * * @param {object} [options] Optional Parameters. * @@ -3760,7 +3808,7 @@ class CloudEndpoints { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - beginPreRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback) { + beginPreRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -3769,14 +3817,14 @@ class CloudEndpoints { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._beginPreRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + self._beginPreRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._beginPreRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback); + return self._beginPreRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, optionalCallback); } } @@ -3793,24 +3841,27 @@ class CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Cloud Endpoint object. + * @param {object} parameters Body of Cloud Endpoint object. * - * @param {string} [body.partition] Post Restore partition. + * @param {string} [parameters.partition] Post Restore partition. * - * @param {string} [body.replicaGroup] Post Restore replica group. + * @param {string} [parameters.replicaGroup] Post Restore replica group. * - * @param {string} [body.requestId] Post Restore request id. + * @param {string} [parameters.requestId] Post Restore request id. * - * @param {string} [body.azureFileShareUri] Post Restore Azure file share uri. + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. * - * @param {string} [body.status] Post Restore Azure status. + * @param {string} [parameters.status] Post Restore Azure status. * - * @param {string} [body.sourceAzureFileShareUri] Post Restore Azure source - * azure file share uri. + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. * - * @param {string} [body.failedFileList] Post Restore Azure failed file list. + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. * - * @param {array} [body.restoreFileSpec] Post Restore restore file spec array. + * @param {array} [parameters.restoreFileSpec] Post Restore restore file spec + * array. * * @param {object} [options] Optional Parameters. * @@ -3823,11 +3874,11 @@ class CloudEndpoints { * * @reject {Error} - The error object. */ - beginPostRestoreWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options) { + beginPostRestoreWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._beginPostRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + self._beginPostRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -3850,24 +3901,27 @@ class CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Cloud Endpoint object. + * @param {object} parameters Body of Cloud Endpoint object. * - * @param {string} [body.partition] Post Restore partition. + * @param {string} [parameters.partition] Post Restore partition. * - * @param {string} [body.replicaGroup] Post Restore replica group. + * @param {string} [parameters.replicaGroup] Post Restore replica group. * - * @param {string} [body.requestId] Post Restore request id. + * @param {string} [parameters.requestId] Post Restore request id. * - * @param {string} [body.azureFileShareUri] Post Restore Azure file share uri. + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. * - * @param {string} [body.status] Post Restore Azure status. + * @param {string} [parameters.status] Post Restore Azure status. * - * @param {string} [body.sourceAzureFileShareUri] Post Restore Azure source - * azure file share uri. + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. * - * @param {string} [body.failedFileList] Post Restore Azure failed file list. + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. * - * @param {array} [body.restoreFileSpec] Post Restore restore file spec array. + * @param {array} [parameters.restoreFileSpec] Post Restore restore file spec + * array. * * @param {object} [options] Optional Parameters. * @@ -3895,7 +3949,7 @@ class CloudEndpoints { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - beginPostRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback) { + beginPostRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -3904,14 +3958,14 @@ class CloudEndpoints { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._beginPostRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, (err, result, request, response) => { + self._beginPostRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._beginPostRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, body, options, optionalCallback); + return self._beginPostRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, optionalCallback); } } diff --git a/lib/services/storagesyncManagement/lib/operations/index.d.ts b/lib/services/storagesyncManagement/lib/operations/index.d.ts index e9b56781b8..1bf2a332ab 100644 --- a/lib/services/storagesyncManagement/lib/operations/index.d.ts +++ b/lib/services/storagesyncManagement/lib/operations/index.d.ts @@ -149,7 +149,7 @@ export interface StorageSyncServices { * @param {string} storageSyncServiceName Name of Storage Sync Service * resource. * - * @param {object} body Storage Sync Service resource name. + * @param {object} parameters Storage Sync Service resource name. * * @param {object} [options] Optional Parameters. * @@ -162,7 +162,7 @@ export interface StorageSyncServices { * * @reject {Error|ServiceError} - The error object. */ - createWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, body: models.StorageSyncService, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, parameters: models.StorageSyncService, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Create a new StorageSyncService. @@ -173,7 +173,7 @@ export interface StorageSyncServices { * @param {string} storageSyncServiceName Name of Storage Sync Service * resource. * - * @param {object} body Storage Sync Service resource name. + * @param {object} parameters Storage Sync Service resource name. * * @param {object} [options] Optional Parameters. * @@ -202,9 +202,9 @@ export interface StorageSyncServices { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - create(resourceGroupName: string, storageSyncServiceName: string, body: models.StorageSyncService, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - create(resourceGroupName: string, storageSyncServiceName: string, body: models.StorageSyncService, callback: ServiceCallback): void; - create(resourceGroupName: string, storageSyncServiceName: string, body: models.StorageSyncService, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + create(resourceGroupName: string, storageSyncServiceName: string, parameters: models.StorageSyncService, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, storageSyncServiceName: string, parameters: models.StorageSyncService, callback: ServiceCallback): void; + create(resourceGroupName: string, storageSyncServiceName: string, parameters: models.StorageSyncService, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -281,7 +281,7 @@ export interface StorageSyncServices { * * @param {object} [options] Optional Parameters. * - * @param {object} [options.body] Storage Sync Service resource. + * @param {object} [options.parameters] Storage Sync Service resource. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -292,7 +292,7 @@ export interface StorageSyncServices { * * @reject {Error|ServiceError} - The error object. */ - updateWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, options?: { body? : models.StorageSyncService, customHeaders? : { [headerName: string]: string; } }): Promise>; + updateWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, options?: { parameters? : models.StorageSyncService, customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Patch a given StorageSyncService. @@ -305,7 +305,7 @@ export interface StorageSyncServices { * * @param {object} [options] Optional Parameters. * - * @param {object} [options.body] Storage Sync Service resource. + * @param {object} [options.parameters] Storage Sync Service resource. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -332,9 +332,9 @@ export interface StorageSyncServices { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - update(resourceGroupName: string, storageSyncServiceName: string, options?: { body? : models.StorageSyncService, customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, storageSyncServiceName: string, options?: { parameters? : models.StorageSyncService, customHeaders? : { [headerName: string]: string; } }): Promise; update(resourceGroupName: string, storageSyncServiceName: string, callback: ServiceCallback): void; - update(resourceGroupName: string, storageSyncServiceName: string, options: { body? : models.StorageSyncService, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + update(resourceGroupName: string, storageSyncServiceName: string, options: { parameters? : models.StorageSyncService, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -592,9 +592,9 @@ export interface SyncGroups { * * @param {string} syncGroupName Name of Sync Group resource. * - * @param {object} body Sync Group Body + * @param {object} parameters Sync Group Body * - * @param {string} [body.uniqueId] Unique Id + * @param {string} [parameters.uniqueId] Unique Id * * @param {object} [options] Optional Parameters. * @@ -607,7 +607,7 @@ export interface SyncGroups { * * @reject {Error|ServiceError} - The error object. */ - createWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, body: models.SyncGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, parameters: models.SyncGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Create a new SyncGroup. @@ -620,9 +620,9 @@ export interface SyncGroups { * * @param {string} syncGroupName Name of Sync Group resource. * - * @param {object} body Sync Group Body + * @param {object} parameters Sync Group Body * - * @param {string} [body.uniqueId] Unique Id + * @param {string} [parameters.uniqueId] Unique Id * * @param {object} [options] Optional Parameters. * @@ -651,9 +651,9 @@ export interface SyncGroups { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - create(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, body: models.SyncGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - create(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, body: models.SyncGroup, callback: ServiceCallback): void; - create(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, body: models.SyncGroup, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + create(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, parameters: models.SyncGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, parameters: models.SyncGroup, callback: ServiceCallback): void; + create(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, parameters: models.SyncGroup, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -811,25 +811,29 @@ export interface CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Cloud Endpoint resource. + * @param {object} parameters Body of Cloud Endpoint resource. * - * @param {string} [body.storageAccountKey] Storage Account access key. + * @param {string} [parameters.storageAccountKey] Storage Account access key. * - * @param {string} [body.storageAccount] Storage Account name. + * @param {string} [parameters.storageAccount] Storage Account name. * - * @param {string} [body.storageAccountResourceId] Storage Account Resource Id + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id * - * @param {string} [body.storageAccountShareName] Storage Account Share name + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name * - * @param {string} [body.storageAccountTenantId] Storage Account Tenant Id + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id * - * @param {string} [body.partnershipId] Partnership Id + * @param {string} [parameters.partnershipId] Partnership Id * - * @param {string} [body.friendlyName] Friendly Name + * @param {string} [parameters.friendlyName] Friendly Name * - * @param {string} [body.provisioningState] CloudEndpoint Provisioning State + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State * - * @param {string} [body.lastWorkflowId] CloudEndpoint lastWorkflowId + * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId * * @param {object} [options] Optional Parameters. * @@ -842,7 +846,7 @@ export interface CloudEndpoints { * * @reject {Error|ServiceError} - The error object. */ - createWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.CloudEndpoint, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.CloudEndpoint, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Create a new CloudEndpoint. @@ -857,25 +861,29 @@ export interface CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Cloud Endpoint resource. + * @param {object} parameters Body of Cloud Endpoint resource. * - * @param {string} [body.storageAccountKey] Storage Account access key. + * @param {string} [parameters.storageAccountKey] Storage Account access key. * - * @param {string} [body.storageAccount] Storage Account name. + * @param {string} [parameters.storageAccount] Storage Account name. * - * @param {string} [body.storageAccountResourceId] Storage Account Resource Id + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id * - * @param {string} [body.storageAccountShareName] Storage Account Share name + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name * - * @param {string} [body.storageAccountTenantId] Storage Account Tenant Id + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id * - * @param {string} [body.partnershipId] Partnership Id + * @param {string} [parameters.partnershipId] Partnership Id * - * @param {string} [body.friendlyName] Friendly Name + * @param {string} [parameters.friendlyName] Friendly Name * - * @param {string} [body.provisioningState] CloudEndpoint Provisioning State + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State * - * @param {string} [body.lastWorkflowId] CloudEndpoint lastWorkflowId + * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId * * @param {object} [options] Optional Parameters. * @@ -904,9 +912,9 @@ export interface CloudEndpoints { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - create(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.CloudEndpoint, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - create(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.CloudEndpoint, callback: ServiceCallback): void; - create(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.CloudEndpoint, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + create(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.CloudEndpoint, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.CloudEndpoint, callback: ServiceCallback): void; + create(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.CloudEndpoint, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -1130,9 +1138,9 @@ export interface CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Backup request. + * @param {object} parameters Body of Backup request. * - * @param {string} [body.azureFileShare] Azure File Share. + * @param {string} [parameters.azureFileShare] Azure File Share. * * @param {object} [options] Optional Parameters. * @@ -1145,7 +1153,7 @@ export interface CloudEndpoints { * * @reject {Error|ServiceError} - The error object. */ - preBackupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + preBackupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Pre Backup a given CloudEndpoint. @@ -1160,9 +1168,9 @@ export interface CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Backup request. + * @param {object} parameters Body of Backup request. * - * @param {string} [body.azureFileShare] Azure File Share. + * @param {string} [parameters.azureFileShare] Azure File Share. * * @param {object} [options] Optional Parameters. * @@ -1190,9 +1198,9 @@ export interface CloudEndpoints { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - preBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - preBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, callback: ServiceCallback): void; - preBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + preBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + preBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.BackupRequest, callback: ServiceCallback): void; + preBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.BackupRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -1208,9 +1216,9 @@ export interface CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Backup request. + * @param {object} parameters Body of Backup request. * - * @param {string} [body.azureFileShare] Azure File Share. + * @param {string} [parameters.azureFileShare] Azure File Share. * * @param {object} [options] Optional Parameters. * @@ -1223,7 +1231,7 @@ export interface CloudEndpoints { * * @reject {Error|ServiceError} - The error object. */ - postBackupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + postBackupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Post Backup a given CloudEndpoint. @@ -1238,9 +1246,9 @@ export interface CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Backup request. + * @param {object} parameters Body of Backup request. * - * @param {string} [body.azureFileShare] Azure File Share. + * @param {string} [parameters.azureFileShare] Azure File Share. * * @param {object} [options] Optional Parameters. * @@ -1269,9 +1277,9 @@ export interface CloudEndpoints { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - postBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - postBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, callback: ServiceCallback): void; - postBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + postBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + postBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.BackupRequest, callback: ServiceCallback): void; + postBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.BackupRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -1287,28 +1295,30 @@ export interface CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Cloud Endpoint object. + * @param {object} parameters Body of Cloud Endpoint object. * - * @param {string} [body.partition] Pre Restore partition. + * @param {string} [parameters.partition] Pre Restore partition. * - * @param {string} [body.replicaGroup] Pre Restore replica group. + * @param {string} [parameters.replicaGroup] Pre Restore replica group. * - * @param {string} [body.requestId] Pre Restore request id. + * @param {string} [parameters.requestId] Pre Restore request id. * - * @param {string} [body.azureFileShareUri] Pre Restore Azure file share uri. + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. * - * @param {string} [body.status] Pre Restore Azure status. + * @param {string} [parameters.status] Pre Restore Azure status. * - * @param {string} [body.sourceAzureFileShareUri] Pre Restore Azure source - * azure file share uri. + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. * - * @param {string} [body.backupMetadataPropertyBag] Pre Restore backup metadata - * property bag. + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. * - * @param {array} [body.restoreFileSpec] Pre Restore restore file spec array. + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. * - * @param {number} [body.pauseWaitForSyncDrainTimePeriodInSeconds] Pre Restore - * pause wait for sync drain time period in seconds. + * @param {number} [parameters.pauseWaitForSyncDrainTimePeriodInSeconds] Pre + * Restore pause wait for sync drain time period in seconds. * * @param {object} [options] Optional Parameters. * @@ -1321,7 +1331,7 @@ export interface CloudEndpoints { * * @reject {Error|ServiceError} - The error object. */ - preRestoreWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PreRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + preRestoreWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.PreRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Pre Restore a given CloudEndpoint. @@ -1336,28 +1346,30 @@ export interface CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Cloud Endpoint object. + * @param {object} parameters Body of Cloud Endpoint object. * - * @param {string} [body.partition] Pre Restore partition. + * @param {string} [parameters.partition] Pre Restore partition. * - * @param {string} [body.replicaGroup] Pre Restore replica group. + * @param {string} [parameters.replicaGroup] Pre Restore replica group. * - * @param {string} [body.requestId] Pre Restore request id. + * @param {string} [parameters.requestId] Pre Restore request id. * - * @param {string} [body.azureFileShareUri] Pre Restore Azure file share uri. + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. * - * @param {string} [body.status] Pre Restore Azure status. + * @param {string} [parameters.status] Pre Restore Azure status. * - * @param {string} [body.sourceAzureFileShareUri] Pre Restore Azure source - * azure file share uri. + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. * - * @param {string} [body.backupMetadataPropertyBag] Pre Restore backup metadata - * property bag. + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. * - * @param {array} [body.restoreFileSpec] Pre Restore restore file spec array. + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. * - * @param {number} [body.pauseWaitForSyncDrainTimePeriodInSeconds] Pre Restore - * pause wait for sync drain time period in seconds. + * @param {number} [parameters.pauseWaitForSyncDrainTimePeriodInSeconds] Pre + * Restore pause wait for sync drain time period in seconds. * * @param {object} [options] Optional Parameters. * @@ -1385,9 +1397,9 @@ export interface CloudEndpoints { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - preRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PreRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - preRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PreRestoreRequest, callback: ServiceCallback): void; - preRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PreRestoreRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + preRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.PreRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + preRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.PreRestoreRequest, callback: ServiceCallback): void; + preRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.PreRestoreRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -1473,24 +1485,27 @@ export interface CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Cloud Endpoint object. + * @param {object} parameters Body of Cloud Endpoint object. * - * @param {string} [body.partition] Post Restore partition. + * @param {string} [parameters.partition] Post Restore partition. * - * @param {string} [body.replicaGroup] Post Restore replica group. + * @param {string} [parameters.replicaGroup] Post Restore replica group. * - * @param {string} [body.requestId] Post Restore request id. + * @param {string} [parameters.requestId] Post Restore request id. * - * @param {string} [body.azureFileShareUri] Post Restore Azure file share uri. + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. * - * @param {string} [body.status] Post Restore Azure status. + * @param {string} [parameters.status] Post Restore Azure status. * - * @param {string} [body.sourceAzureFileShareUri] Post Restore Azure source - * azure file share uri. + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. * - * @param {string} [body.failedFileList] Post Restore Azure failed file list. + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. * - * @param {array} [body.restoreFileSpec] Post Restore restore file spec array. + * @param {array} [parameters.restoreFileSpec] Post Restore restore file spec + * array. * * @param {object} [options] Optional Parameters. * @@ -1503,7 +1518,7 @@ export interface CloudEndpoints { * * @reject {Error|ServiceError} - The error object. */ - postRestoreWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PostRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + postRestoreWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.PostRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Post Restore a given CloudEndpoint. @@ -1518,24 +1533,27 @@ export interface CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Cloud Endpoint object. + * @param {object} parameters Body of Cloud Endpoint object. * - * @param {string} [body.partition] Post Restore partition. + * @param {string} [parameters.partition] Post Restore partition. * - * @param {string} [body.replicaGroup] Post Restore replica group. + * @param {string} [parameters.replicaGroup] Post Restore replica group. * - * @param {string} [body.requestId] Post Restore request id. + * @param {string} [parameters.requestId] Post Restore request id. * - * @param {string} [body.azureFileShareUri] Post Restore Azure file share uri. + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. * - * @param {string} [body.status] Post Restore Azure status. + * @param {string} [parameters.status] Post Restore Azure status. * - * @param {string} [body.sourceAzureFileShareUri] Post Restore Azure source - * azure file share uri. + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. * - * @param {string} [body.failedFileList] Post Restore Azure failed file list. + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. * - * @param {array} [body.restoreFileSpec] Post Restore restore file spec array. + * @param {array} [parameters.restoreFileSpec] Post Restore restore file spec + * array. * * @param {object} [options] Optional Parameters. * @@ -1563,9 +1581,9 @@ export interface CloudEndpoints { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - postRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PostRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - postRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PostRestoreRequest, callback: ServiceCallback): void; - postRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PostRestoreRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + postRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.PostRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + postRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.PostRestoreRequest, callback: ServiceCallback): void; + postRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.PostRestoreRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -1581,25 +1599,29 @@ export interface CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Cloud Endpoint resource. + * @param {object} parameters Body of Cloud Endpoint resource. * - * @param {string} [body.storageAccountKey] Storage Account access key. + * @param {string} [parameters.storageAccountKey] Storage Account access key. * - * @param {string} [body.storageAccount] Storage Account name. + * @param {string} [parameters.storageAccount] Storage Account name. * - * @param {string} [body.storageAccountResourceId] Storage Account Resource Id + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id * - * @param {string} [body.storageAccountShareName] Storage Account Share name + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name * - * @param {string} [body.storageAccountTenantId] Storage Account Tenant Id + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id * - * @param {string} [body.partnershipId] Partnership Id + * @param {string} [parameters.partnershipId] Partnership Id * - * @param {string} [body.friendlyName] Friendly Name + * @param {string} [parameters.friendlyName] Friendly Name * - * @param {string} [body.provisioningState] CloudEndpoint Provisioning State + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State * - * @param {string} [body.lastWorkflowId] CloudEndpoint lastWorkflowId + * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId * * @param {object} [options] Optional Parameters. * @@ -1612,7 +1634,7 @@ export interface CloudEndpoints { * * @reject {Error|ServiceError} - The error object. */ - beginCreateWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.CloudEndpoint, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginCreateWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.CloudEndpoint, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Create a new CloudEndpoint. @@ -1627,25 +1649,29 @@ export interface CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Cloud Endpoint resource. + * @param {object} parameters Body of Cloud Endpoint resource. * - * @param {string} [body.storageAccountKey] Storage Account access key. + * @param {string} [parameters.storageAccountKey] Storage Account access key. * - * @param {string} [body.storageAccount] Storage Account name. + * @param {string} [parameters.storageAccount] Storage Account name. * - * @param {string} [body.storageAccountResourceId] Storage Account Resource Id + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id * - * @param {string} [body.storageAccountShareName] Storage Account Share name + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name * - * @param {string} [body.storageAccountTenantId] Storage Account Tenant Id + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id * - * @param {string} [body.partnershipId] Partnership Id + * @param {string} [parameters.partnershipId] Partnership Id * - * @param {string} [body.friendlyName] Friendly Name + * @param {string} [parameters.friendlyName] Friendly Name * - * @param {string} [body.provisioningState] CloudEndpoint Provisioning State + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State * - * @param {string} [body.lastWorkflowId] CloudEndpoint lastWorkflowId + * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId * * @param {object} [options] Optional Parameters. * @@ -1674,9 +1700,9 @@ export interface CloudEndpoints { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginCreate(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.CloudEndpoint, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginCreate(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.CloudEndpoint, callback: ServiceCallback): void; - beginCreate(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.CloudEndpoint, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginCreate(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.CloudEndpoint, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreate(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.CloudEndpoint, callback: ServiceCallback): void; + beginCreate(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.CloudEndpoint, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -1762,9 +1788,9 @@ export interface CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Backup request. + * @param {object} parameters Body of Backup request. * - * @param {string} [body.azureFileShare] Azure File Share. + * @param {string} [parameters.azureFileShare] Azure File Share. * * @param {object} [options] Optional Parameters. * @@ -1777,7 +1803,7 @@ export interface CloudEndpoints { * * @reject {Error|ServiceError} - The error object. */ - beginPreBackupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginPreBackupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Pre Backup a given CloudEndpoint. @@ -1792,9 +1818,9 @@ export interface CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Backup request. + * @param {object} parameters Body of Backup request. * - * @param {string} [body.azureFileShare] Azure File Share. + * @param {string} [parameters.azureFileShare] Azure File Share. * * @param {object} [options] Optional Parameters. * @@ -1822,9 +1848,9 @@ export interface CloudEndpoints { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginPreBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginPreBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, callback: ServiceCallback): void; - beginPreBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginPreBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginPreBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.BackupRequest, callback: ServiceCallback): void; + beginPreBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.BackupRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -1840,9 +1866,9 @@ export interface CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Backup request. + * @param {object} parameters Body of Backup request. * - * @param {string} [body.azureFileShare] Azure File Share. + * @param {string} [parameters.azureFileShare] Azure File Share. * * @param {object} [options] Optional Parameters. * @@ -1855,7 +1881,7 @@ export interface CloudEndpoints { * * @reject {Error|ServiceError} - The error object. */ - beginPostBackupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginPostBackupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Post Backup a given CloudEndpoint. @@ -1870,9 +1896,9 @@ export interface CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Backup request. + * @param {object} parameters Body of Backup request. * - * @param {string} [body.azureFileShare] Azure File Share. + * @param {string} [parameters.azureFileShare] Azure File Share. * * @param {object} [options] Optional Parameters. * @@ -1901,9 +1927,9 @@ export interface CloudEndpoints { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginPostBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginPostBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, callback: ServiceCallback): void; - beginPostBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.BackupRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginPostBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.BackupRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginPostBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.BackupRequest, callback: ServiceCallback): void; + beginPostBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.BackupRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -1919,28 +1945,30 @@ export interface CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Cloud Endpoint object. + * @param {object} parameters Body of Cloud Endpoint object. * - * @param {string} [body.partition] Pre Restore partition. + * @param {string} [parameters.partition] Pre Restore partition. * - * @param {string} [body.replicaGroup] Pre Restore replica group. + * @param {string} [parameters.replicaGroup] Pre Restore replica group. * - * @param {string} [body.requestId] Pre Restore request id. + * @param {string} [parameters.requestId] Pre Restore request id. * - * @param {string} [body.azureFileShareUri] Pre Restore Azure file share uri. + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. * - * @param {string} [body.status] Pre Restore Azure status. + * @param {string} [parameters.status] Pre Restore Azure status. * - * @param {string} [body.sourceAzureFileShareUri] Pre Restore Azure source - * azure file share uri. + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. * - * @param {string} [body.backupMetadataPropertyBag] Pre Restore backup metadata - * property bag. + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. * - * @param {array} [body.restoreFileSpec] Pre Restore restore file spec array. + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. * - * @param {number} [body.pauseWaitForSyncDrainTimePeriodInSeconds] Pre Restore - * pause wait for sync drain time period in seconds. + * @param {number} [parameters.pauseWaitForSyncDrainTimePeriodInSeconds] Pre + * Restore pause wait for sync drain time period in seconds. * * @param {object} [options] Optional Parameters. * @@ -1953,7 +1981,7 @@ export interface CloudEndpoints { * * @reject {Error|ServiceError} - The error object. */ - beginPreRestoreWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PreRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginPreRestoreWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.PreRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Pre Restore a given CloudEndpoint. @@ -1968,28 +1996,30 @@ export interface CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Cloud Endpoint object. + * @param {object} parameters Body of Cloud Endpoint object. * - * @param {string} [body.partition] Pre Restore partition. + * @param {string} [parameters.partition] Pre Restore partition. * - * @param {string} [body.replicaGroup] Pre Restore replica group. + * @param {string} [parameters.replicaGroup] Pre Restore replica group. * - * @param {string} [body.requestId] Pre Restore request id. + * @param {string} [parameters.requestId] Pre Restore request id. * - * @param {string} [body.azureFileShareUri] Pre Restore Azure file share uri. + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. * - * @param {string} [body.status] Pre Restore Azure status. + * @param {string} [parameters.status] Pre Restore Azure status. * - * @param {string} [body.sourceAzureFileShareUri] Pre Restore Azure source - * azure file share uri. + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. * - * @param {string} [body.backupMetadataPropertyBag] Pre Restore backup metadata - * property bag. + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. * - * @param {array} [body.restoreFileSpec] Pre Restore restore file spec array. + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. * - * @param {number} [body.pauseWaitForSyncDrainTimePeriodInSeconds] Pre Restore - * pause wait for sync drain time period in seconds. + * @param {number} [parameters.pauseWaitForSyncDrainTimePeriodInSeconds] Pre + * Restore pause wait for sync drain time period in seconds. * * @param {object} [options] Optional Parameters. * @@ -2017,9 +2047,9 @@ export interface CloudEndpoints { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginPreRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PreRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginPreRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PreRestoreRequest, callback: ServiceCallback): void; - beginPreRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PreRestoreRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginPreRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.PreRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginPreRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.PreRestoreRequest, callback: ServiceCallback): void; + beginPreRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.PreRestoreRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -2035,24 +2065,27 @@ export interface CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Cloud Endpoint object. + * @param {object} parameters Body of Cloud Endpoint object. * - * @param {string} [body.partition] Post Restore partition. + * @param {string} [parameters.partition] Post Restore partition. * - * @param {string} [body.replicaGroup] Post Restore replica group. + * @param {string} [parameters.replicaGroup] Post Restore replica group. * - * @param {string} [body.requestId] Post Restore request id. + * @param {string} [parameters.requestId] Post Restore request id. * - * @param {string} [body.azureFileShareUri] Post Restore Azure file share uri. + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. * - * @param {string} [body.status] Post Restore Azure status. + * @param {string} [parameters.status] Post Restore Azure status. * - * @param {string} [body.sourceAzureFileShareUri] Post Restore Azure source - * azure file share uri. + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. * - * @param {string} [body.failedFileList] Post Restore Azure failed file list. + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. * - * @param {array} [body.restoreFileSpec] Post Restore restore file spec array. + * @param {array} [parameters.restoreFileSpec] Post Restore restore file spec + * array. * * @param {object} [options] Optional Parameters. * @@ -2065,7 +2098,7 @@ export interface CloudEndpoints { * * @reject {Error|ServiceError} - The error object. */ - beginPostRestoreWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PostRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginPostRestoreWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.PostRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Post Restore a given CloudEndpoint. @@ -2080,24 +2113,27 @@ export interface CloudEndpoints { * * @param {string} cloudEndpointName Name of Cloud Endpoint object. * - * @param {object} body Body of Cloud Endpoint object. + * @param {object} parameters Body of Cloud Endpoint object. * - * @param {string} [body.partition] Post Restore partition. + * @param {string} [parameters.partition] Post Restore partition. * - * @param {string} [body.replicaGroup] Post Restore replica group. + * @param {string} [parameters.replicaGroup] Post Restore replica group. * - * @param {string} [body.requestId] Post Restore request id. + * @param {string} [parameters.requestId] Post Restore request id. * - * @param {string} [body.azureFileShareUri] Post Restore Azure file share uri. + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. * - * @param {string} [body.status] Post Restore Azure status. + * @param {string} [parameters.status] Post Restore Azure status. * - * @param {string} [body.sourceAzureFileShareUri] Post Restore Azure source - * azure file share uri. + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. * - * @param {string} [body.failedFileList] Post Restore Azure failed file list. + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. * - * @param {array} [body.restoreFileSpec] Post Restore restore file spec array. + * @param {array} [parameters.restoreFileSpec] Post Restore restore file spec + * array. * * @param {object} [options] Optional Parameters. * @@ -2125,9 +2161,9 @@ export interface CloudEndpoints { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginPostRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PostRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginPostRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PostRestoreRequest, callback: ServiceCallback): void; - beginPostRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, body: models.PostRestoreRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginPostRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.PostRestoreRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginPostRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.PostRestoreRequest, callback: ServiceCallback): void; + beginPostRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: models.PostRestoreRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** @@ -2152,51 +2188,56 @@ export interface ServerEndpoints { * * @param {string} serverEndpointName Name of Server Endpoint object. * - * @param {object} body Body of Server Endpoint object. + * @param {object} parameters Body of Server Endpoint object. * - * @param {string} [body.serverLocalPath] Server Local path. + * @param {string} [parameters.serverLocalPath] Server Local path. * - * @param {string} [body.cloudTiering] Cloud Tiering. Possible values include: - * 'on', 'off' + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' * - * @param {number} [body.volumeFreeSpacePercent] Level of free space to be - * maintained by Cloud Tiering if it is enabled. + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. * - * @param {string} [body.friendlyName] Friendly Name + * @param {string} [parameters.friendlyName] Friendly Name * - * @param {date} [body.lastSyncSuccess] Last Sync Success + * @param {date} [parameters.lastSyncSuccess] Last Sync Success * - * @param {string} [body.syncErrorState] Sync Error State + * @param {string} [parameters.syncErrorState] Sync Error State * - * @param {date} [body.syncErrorStateTimestamp] Sync Error State Timestamp + * @param {date} [parameters.syncErrorStateTimestamp] Sync Error State + * Timestamp * - * @param {string} [body.syncErrorDirection] Sync Error Direction. Possible - * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * @param {string} [parameters.syncErrorDirection] Sync Error Direction. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' * - * @param {number} [body.itemUploadErrorCount] Item Upload Error Count. + * @param {number} [parameters.itemUploadErrorCount] Item Upload Error Count. * - * @param {number} [body.itemDownloadErrorCount] Item download error count. + * @param {number} [parameters.itemDownloadErrorCount] Item download error + * count. * - * @param {string} [body.syncErrorContext] sync error context. + * @param {string} [parameters.syncErrorContext] sync error context. * - * @param {string} [body.currentProgressType] current progress type. Possible - * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * @param {string} [parameters.currentProgressType] current progress type. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' * - * @param {number} [body.itemProgressCount] Item Progress Count + * @param {number} [parameters.itemProgressCount] Item Progress Count * - * @param {number} [body.itemTotalCount] Item Total Count + * @param {number} [parameters.itemTotalCount] Item Total Count * - * @param {number} [body.byteProgress] Bytes in progress + * @param {number} [parameters.byteProgress] Bytes in progress * - * @param {number} [body.totalProgress] Total progress + * @param {number} [parameters.totalProgress] Total progress * - * @param {number} [body.byteTotal] Bytes total + * @param {number} [parameters.byteTotal] Bytes total * - * @param {string} [body.serverResourceId] Server Resource Id. + * @param {string} [parameters.serverResourceId] Server Resource Id. * - * @param {string} [body.provisioningState] ServerEndpoint Provisioning State + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State * - * @param {string} [body.lastWorkflowId] ServerEndpoint lastWorkflowId + * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId * * @param {object} [options] Optional Parameters. * @@ -2209,7 +2250,7 @@ export interface ServerEndpoints { * * @reject {Error|ServiceError} - The error object. */ - createWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, body: models.ServerEndpoint, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, parameters: models.ServerEndpoint, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Create a new ServerEndpoint. @@ -2224,51 +2265,56 @@ export interface ServerEndpoints { * * @param {string} serverEndpointName Name of Server Endpoint object. * - * @param {object} body Body of Server Endpoint object. + * @param {object} parameters Body of Server Endpoint object. * - * @param {string} [body.serverLocalPath] Server Local path. + * @param {string} [parameters.serverLocalPath] Server Local path. * - * @param {string} [body.cloudTiering] Cloud Tiering. Possible values include: - * 'on', 'off' + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' * - * @param {number} [body.volumeFreeSpacePercent] Level of free space to be - * maintained by Cloud Tiering if it is enabled. + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. * - * @param {string} [body.friendlyName] Friendly Name + * @param {string} [parameters.friendlyName] Friendly Name * - * @param {date} [body.lastSyncSuccess] Last Sync Success + * @param {date} [parameters.lastSyncSuccess] Last Sync Success * - * @param {string} [body.syncErrorState] Sync Error State + * @param {string} [parameters.syncErrorState] Sync Error State * - * @param {date} [body.syncErrorStateTimestamp] Sync Error State Timestamp + * @param {date} [parameters.syncErrorStateTimestamp] Sync Error State + * Timestamp * - * @param {string} [body.syncErrorDirection] Sync Error Direction. Possible - * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * @param {string} [parameters.syncErrorDirection] Sync Error Direction. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' * - * @param {number} [body.itemUploadErrorCount] Item Upload Error Count. + * @param {number} [parameters.itemUploadErrorCount] Item Upload Error Count. * - * @param {number} [body.itemDownloadErrorCount] Item download error count. + * @param {number} [parameters.itemDownloadErrorCount] Item download error + * count. * - * @param {string} [body.syncErrorContext] sync error context. + * @param {string} [parameters.syncErrorContext] sync error context. * - * @param {string} [body.currentProgressType] current progress type. Possible - * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * @param {string} [parameters.currentProgressType] current progress type. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' * - * @param {number} [body.itemProgressCount] Item Progress Count + * @param {number} [parameters.itemProgressCount] Item Progress Count * - * @param {number} [body.itemTotalCount] Item Total Count + * @param {number} [parameters.itemTotalCount] Item Total Count * - * @param {number} [body.byteProgress] Bytes in progress + * @param {number} [parameters.byteProgress] Bytes in progress * - * @param {number} [body.totalProgress] Total progress + * @param {number} [parameters.totalProgress] Total progress * - * @param {number} [body.byteTotal] Bytes total + * @param {number} [parameters.byteTotal] Bytes total * - * @param {string} [body.serverResourceId] Server Resource Id. + * @param {string} [parameters.serverResourceId] Server Resource Id. * - * @param {string} [body.provisioningState] ServerEndpoint Provisioning State + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State * - * @param {string} [body.lastWorkflowId] ServerEndpoint lastWorkflowId + * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId * * @param {object} [options] Optional Parameters. * @@ -2297,9 +2343,9 @@ export interface ServerEndpoints { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - create(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, body: models.ServerEndpoint, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - create(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, body: models.ServerEndpoint, callback: ServiceCallback): void; - create(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, body: models.ServerEndpoint, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + create(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, parameters: models.ServerEndpoint, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, parameters: models.ServerEndpoint, callback: ServiceCallback): void; + create(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, parameters: models.ServerEndpoint, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -2317,57 +2363,59 @@ export interface ServerEndpoints { * * @param {object} [options] Optional Parameters. * - * @param {object} [options.body] Any of the properties applicable in PUT + * @param {object} [options.parameters] Any of the properties applicable in PUT * request. * - * @param {string} [options.body.serverLocalPath] Server Local path. + * @param {string} [options.parameters.serverLocalPath] Server Local path. * - * @param {string} [options.body.cloudTiering] Cloud Tiering. Possible values - * include: 'on', 'off' + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' * - * @param {number} [options.body.volumeFreeSpacePercent] Level of free space to - * be maintained by Cloud Tiering if it is enabled. + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. * - * @param {string} [options.body.friendlyName] Friendly Name + * @param {string} [options.parameters.friendlyName] Friendly Name * - * @param {date} [options.body.lastSyncSuccess] Last Sync Success + * @param {date} [options.parameters.lastSyncSuccess] Last Sync Success * - * @param {string} [options.body.syncErrorState] Sync Error State + * @param {string} [options.parameters.syncErrorState] Sync Error State * - * @param {date} [options.body.syncErrorStateTimestamp] Sync Error State + * @param {date} [options.parameters.syncErrorStateTimestamp] Sync Error State * Timestamp * - * @param {string} [options.body.syncErrorDirection] Sync Error Direction. - * Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' + * @param {string} [options.parameters.syncErrorDirection] Sync Error + * Direction. Possible values include: 'none', 'initialize', 'download', + * 'upload', 'recall' * - * @param {number} [options.body.itemUploadErrorCount] Item Upload Error Count. + * @param {number} [options.parameters.itemUploadErrorCount] Item Upload Error + * Count. * - * @param {number} [options.body.itemDownloadErrorCount] Item download error - * count. + * @param {number} [options.parameters.itemDownloadErrorCount] Item download + * error count. * - * @param {string} [options.body.syncErrorContext] sync error context. + * @param {string} [options.parameters.syncErrorContext] sync error context. * - * @param {string} [options.body.currentProgressType] current progress type. - * Possible values include: 'none', 'initialize', 'download', 'upload', + * @param {string} [options.parameters.currentProgressType] current progress + * type. Possible values include: 'none', 'initialize', 'download', 'upload', * 'recall' * - * @param {number} [options.body.itemProgressCount] Item Progress Count + * @param {number} [options.parameters.itemProgressCount] Item Progress Count * - * @param {number} [options.body.itemTotalCount] Item Total Count + * @param {number} [options.parameters.itemTotalCount] Item Total Count * - * @param {number} [options.body.byteProgress] Bytes in progress + * @param {number} [options.parameters.byteProgress] Bytes in progress * - * @param {number} [options.body.totalProgress] Total progress + * @param {number} [options.parameters.totalProgress] Total progress * - * @param {number} [options.body.byteTotal] Bytes total + * @param {number} [options.parameters.byteTotal] Bytes total * - * @param {string} [options.body.serverResourceId] Server Resource Id. + * @param {string} [options.parameters.serverResourceId] Server Resource Id. * - * @param {string} [options.body.provisioningState] ServerEndpoint Provisioning - * State + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State * - * @param {string} [options.body.lastWorkflowId] ServerEndpoint lastWorkflowId + * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint + * lastWorkflowId * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -2378,7 +2426,7 @@ export interface ServerEndpoints { * * @reject {Error|ServiceError} - The error object. */ - updateWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { body? : models.ServerEndpoint, customHeaders? : { [headerName: string]: string; } }): Promise>; + updateWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { parameters? : models.ServerEndpoint, customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Patch a given ServerEndpoint. @@ -2395,57 +2443,59 @@ export interface ServerEndpoints { * * @param {object} [options] Optional Parameters. * - * @param {object} [options.body] Any of the properties applicable in PUT + * @param {object} [options.parameters] Any of the properties applicable in PUT * request. * - * @param {string} [options.body.serverLocalPath] Server Local path. + * @param {string} [options.parameters.serverLocalPath] Server Local path. * - * @param {string} [options.body.cloudTiering] Cloud Tiering. Possible values - * include: 'on', 'off' + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' * - * @param {number} [options.body.volumeFreeSpacePercent] Level of free space to - * be maintained by Cloud Tiering if it is enabled. + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. * - * @param {string} [options.body.friendlyName] Friendly Name + * @param {string} [options.parameters.friendlyName] Friendly Name * - * @param {date} [options.body.lastSyncSuccess] Last Sync Success + * @param {date} [options.parameters.lastSyncSuccess] Last Sync Success * - * @param {string} [options.body.syncErrorState] Sync Error State + * @param {string} [options.parameters.syncErrorState] Sync Error State * - * @param {date} [options.body.syncErrorStateTimestamp] Sync Error State + * @param {date} [options.parameters.syncErrorStateTimestamp] Sync Error State * Timestamp * - * @param {string} [options.body.syncErrorDirection] Sync Error Direction. - * Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' + * @param {string} [options.parameters.syncErrorDirection] Sync Error + * Direction. Possible values include: 'none', 'initialize', 'download', + * 'upload', 'recall' * - * @param {number} [options.body.itemUploadErrorCount] Item Upload Error Count. + * @param {number} [options.parameters.itemUploadErrorCount] Item Upload Error + * Count. * - * @param {number} [options.body.itemDownloadErrorCount] Item download error - * count. + * @param {number} [options.parameters.itemDownloadErrorCount] Item download + * error count. * - * @param {string} [options.body.syncErrorContext] sync error context. + * @param {string} [options.parameters.syncErrorContext] sync error context. * - * @param {string} [options.body.currentProgressType] current progress type. - * Possible values include: 'none', 'initialize', 'download', 'upload', + * @param {string} [options.parameters.currentProgressType] current progress + * type. Possible values include: 'none', 'initialize', 'download', 'upload', * 'recall' * - * @param {number} [options.body.itemProgressCount] Item Progress Count + * @param {number} [options.parameters.itemProgressCount] Item Progress Count * - * @param {number} [options.body.itemTotalCount] Item Total Count + * @param {number} [options.parameters.itemTotalCount] Item Total Count * - * @param {number} [options.body.byteProgress] Bytes in progress + * @param {number} [options.parameters.byteProgress] Bytes in progress * - * @param {number} [options.body.totalProgress] Total progress + * @param {number} [options.parameters.totalProgress] Total progress * - * @param {number} [options.body.byteTotal] Bytes total + * @param {number} [options.parameters.byteTotal] Bytes total * - * @param {string} [options.body.serverResourceId] Server Resource Id. + * @param {string} [options.parameters.serverResourceId] Server Resource Id. * - * @param {string} [options.body.provisioningState] ServerEndpoint Provisioning - * State + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State * - * @param {string} [options.body.lastWorkflowId] ServerEndpoint lastWorkflowId + * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint + * lastWorkflowId * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -2472,9 +2522,9 @@ export interface ServerEndpoints { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - update(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { body? : models.ServerEndpoint, customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { parameters? : models.ServerEndpoint, customHeaders? : { [headerName: string]: string; } }): Promise; update(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, callback: ServiceCallback): void; - update(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options: { body? : models.ServerEndpoint, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + update(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options: { parameters? : models.ServerEndpoint, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -2768,51 +2818,56 @@ export interface ServerEndpoints { * * @param {string} serverEndpointName Name of Server Endpoint object. * - * @param {object} body Body of Server Endpoint object. + * @param {object} parameters Body of Server Endpoint object. * - * @param {string} [body.serverLocalPath] Server Local path. + * @param {string} [parameters.serverLocalPath] Server Local path. * - * @param {string} [body.cloudTiering] Cloud Tiering. Possible values include: - * 'on', 'off' + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' * - * @param {number} [body.volumeFreeSpacePercent] Level of free space to be - * maintained by Cloud Tiering if it is enabled. + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. * - * @param {string} [body.friendlyName] Friendly Name + * @param {string} [parameters.friendlyName] Friendly Name * - * @param {date} [body.lastSyncSuccess] Last Sync Success + * @param {date} [parameters.lastSyncSuccess] Last Sync Success * - * @param {string} [body.syncErrorState] Sync Error State + * @param {string} [parameters.syncErrorState] Sync Error State * - * @param {date} [body.syncErrorStateTimestamp] Sync Error State Timestamp + * @param {date} [parameters.syncErrorStateTimestamp] Sync Error State + * Timestamp * - * @param {string} [body.syncErrorDirection] Sync Error Direction. Possible - * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * @param {string} [parameters.syncErrorDirection] Sync Error Direction. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' * - * @param {number} [body.itemUploadErrorCount] Item Upload Error Count. + * @param {number} [parameters.itemUploadErrorCount] Item Upload Error Count. * - * @param {number} [body.itemDownloadErrorCount] Item download error count. + * @param {number} [parameters.itemDownloadErrorCount] Item download error + * count. * - * @param {string} [body.syncErrorContext] sync error context. + * @param {string} [parameters.syncErrorContext] sync error context. * - * @param {string} [body.currentProgressType] current progress type. Possible - * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * @param {string} [parameters.currentProgressType] current progress type. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' * - * @param {number} [body.itemProgressCount] Item Progress Count + * @param {number} [parameters.itemProgressCount] Item Progress Count * - * @param {number} [body.itemTotalCount] Item Total Count + * @param {number} [parameters.itemTotalCount] Item Total Count * - * @param {number} [body.byteProgress] Bytes in progress + * @param {number} [parameters.byteProgress] Bytes in progress * - * @param {number} [body.totalProgress] Total progress + * @param {number} [parameters.totalProgress] Total progress * - * @param {number} [body.byteTotal] Bytes total + * @param {number} [parameters.byteTotal] Bytes total * - * @param {string} [body.serverResourceId] Server Resource Id. + * @param {string} [parameters.serverResourceId] Server Resource Id. * - * @param {string} [body.provisioningState] ServerEndpoint Provisioning State + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State * - * @param {string} [body.lastWorkflowId] ServerEndpoint lastWorkflowId + * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId * * @param {object} [options] Optional Parameters. * @@ -2825,7 +2880,7 @@ export interface ServerEndpoints { * * @reject {Error|ServiceError} - The error object. */ - beginCreateWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, body: models.ServerEndpoint, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginCreateWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, parameters: models.ServerEndpoint, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Create a new ServerEndpoint. @@ -2840,51 +2895,56 @@ export interface ServerEndpoints { * * @param {string} serverEndpointName Name of Server Endpoint object. * - * @param {object} body Body of Server Endpoint object. + * @param {object} parameters Body of Server Endpoint object. * - * @param {string} [body.serverLocalPath] Server Local path. + * @param {string} [parameters.serverLocalPath] Server Local path. * - * @param {string} [body.cloudTiering] Cloud Tiering. Possible values include: - * 'on', 'off' + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' * - * @param {number} [body.volumeFreeSpacePercent] Level of free space to be - * maintained by Cloud Tiering if it is enabled. + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. * - * @param {string} [body.friendlyName] Friendly Name + * @param {string} [parameters.friendlyName] Friendly Name * - * @param {date} [body.lastSyncSuccess] Last Sync Success + * @param {date} [parameters.lastSyncSuccess] Last Sync Success * - * @param {string} [body.syncErrorState] Sync Error State + * @param {string} [parameters.syncErrorState] Sync Error State * - * @param {date} [body.syncErrorStateTimestamp] Sync Error State Timestamp + * @param {date} [parameters.syncErrorStateTimestamp] Sync Error State + * Timestamp * - * @param {string} [body.syncErrorDirection] Sync Error Direction. Possible - * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * @param {string} [parameters.syncErrorDirection] Sync Error Direction. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' * - * @param {number} [body.itemUploadErrorCount] Item Upload Error Count. + * @param {number} [parameters.itemUploadErrorCount] Item Upload Error Count. * - * @param {number} [body.itemDownloadErrorCount] Item download error count. + * @param {number} [parameters.itemDownloadErrorCount] Item download error + * count. * - * @param {string} [body.syncErrorContext] sync error context. + * @param {string} [parameters.syncErrorContext] sync error context. * - * @param {string} [body.currentProgressType] current progress type. Possible - * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * @param {string} [parameters.currentProgressType] current progress type. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' * - * @param {number} [body.itemProgressCount] Item Progress Count + * @param {number} [parameters.itemProgressCount] Item Progress Count * - * @param {number} [body.itemTotalCount] Item Total Count + * @param {number} [parameters.itemTotalCount] Item Total Count * - * @param {number} [body.byteProgress] Bytes in progress + * @param {number} [parameters.byteProgress] Bytes in progress * - * @param {number} [body.totalProgress] Total progress + * @param {number} [parameters.totalProgress] Total progress * - * @param {number} [body.byteTotal] Bytes total + * @param {number} [parameters.byteTotal] Bytes total * - * @param {string} [body.serverResourceId] Server Resource Id. + * @param {string} [parameters.serverResourceId] Server Resource Id. * - * @param {string} [body.provisioningState] ServerEndpoint Provisioning State + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State * - * @param {string} [body.lastWorkflowId] ServerEndpoint lastWorkflowId + * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId * * @param {object} [options] Optional Parameters. * @@ -2913,9 +2973,9 @@ export interface ServerEndpoints { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginCreate(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, body: models.ServerEndpoint, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginCreate(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, body: models.ServerEndpoint, callback: ServiceCallback): void; - beginCreate(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, body: models.ServerEndpoint, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginCreate(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, parameters: models.ServerEndpoint, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreate(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, parameters: models.ServerEndpoint, callback: ServiceCallback): void; + beginCreate(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, parameters: models.ServerEndpoint, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -2933,57 +2993,59 @@ export interface ServerEndpoints { * * @param {object} [options] Optional Parameters. * - * @param {object} [options.body] Any of the properties applicable in PUT + * @param {object} [options.parameters] Any of the properties applicable in PUT * request. * - * @param {string} [options.body.serverLocalPath] Server Local path. + * @param {string} [options.parameters.serverLocalPath] Server Local path. * - * @param {string} [options.body.cloudTiering] Cloud Tiering. Possible values - * include: 'on', 'off' + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' * - * @param {number} [options.body.volumeFreeSpacePercent] Level of free space to - * be maintained by Cloud Tiering if it is enabled. + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. * - * @param {string} [options.body.friendlyName] Friendly Name + * @param {string} [options.parameters.friendlyName] Friendly Name * - * @param {date} [options.body.lastSyncSuccess] Last Sync Success + * @param {date} [options.parameters.lastSyncSuccess] Last Sync Success * - * @param {string} [options.body.syncErrorState] Sync Error State + * @param {string} [options.parameters.syncErrorState] Sync Error State * - * @param {date} [options.body.syncErrorStateTimestamp] Sync Error State + * @param {date} [options.parameters.syncErrorStateTimestamp] Sync Error State * Timestamp * - * @param {string} [options.body.syncErrorDirection] Sync Error Direction. - * Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' + * @param {string} [options.parameters.syncErrorDirection] Sync Error + * Direction. Possible values include: 'none', 'initialize', 'download', + * 'upload', 'recall' * - * @param {number} [options.body.itemUploadErrorCount] Item Upload Error Count. + * @param {number} [options.parameters.itemUploadErrorCount] Item Upload Error + * Count. * - * @param {number} [options.body.itemDownloadErrorCount] Item download error - * count. + * @param {number} [options.parameters.itemDownloadErrorCount] Item download + * error count. * - * @param {string} [options.body.syncErrorContext] sync error context. + * @param {string} [options.parameters.syncErrorContext] sync error context. * - * @param {string} [options.body.currentProgressType] current progress type. - * Possible values include: 'none', 'initialize', 'download', 'upload', + * @param {string} [options.parameters.currentProgressType] current progress + * type. Possible values include: 'none', 'initialize', 'download', 'upload', * 'recall' * - * @param {number} [options.body.itemProgressCount] Item Progress Count + * @param {number} [options.parameters.itemProgressCount] Item Progress Count * - * @param {number} [options.body.itemTotalCount] Item Total Count + * @param {number} [options.parameters.itemTotalCount] Item Total Count * - * @param {number} [options.body.byteProgress] Bytes in progress + * @param {number} [options.parameters.byteProgress] Bytes in progress * - * @param {number} [options.body.totalProgress] Total progress + * @param {number} [options.parameters.totalProgress] Total progress * - * @param {number} [options.body.byteTotal] Bytes total + * @param {number} [options.parameters.byteTotal] Bytes total * - * @param {string} [options.body.serverResourceId] Server Resource Id. + * @param {string} [options.parameters.serverResourceId] Server Resource Id. * - * @param {string} [options.body.provisioningState] ServerEndpoint Provisioning - * State + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State * - * @param {string} [options.body.lastWorkflowId] ServerEndpoint lastWorkflowId + * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint + * lastWorkflowId * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -2994,7 +3056,7 @@ export interface ServerEndpoints { * * @reject {Error|ServiceError} - The error object. */ - beginUpdateWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { body? : models.ServerEndpoint, customHeaders? : { [headerName: string]: string; } }): Promise>; + beginUpdateWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { parameters? : models.ServerEndpoint, customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Patch a given ServerEndpoint. @@ -3011,57 +3073,59 @@ export interface ServerEndpoints { * * @param {object} [options] Optional Parameters. * - * @param {object} [options.body] Any of the properties applicable in PUT + * @param {object} [options.parameters] Any of the properties applicable in PUT * request. * - * @param {string} [options.body.serverLocalPath] Server Local path. + * @param {string} [options.parameters.serverLocalPath] Server Local path. * - * @param {string} [options.body.cloudTiering] Cloud Tiering. Possible values - * include: 'on', 'off' + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' * - * @param {number} [options.body.volumeFreeSpacePercent] Level of free space to - * be maintained by Cloud Tiering if it is enabled. + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. * - * @param {string} [options.body.friendlyName] Friendly Name + * @param {string} [options.parameters.friendlyName] Friendly Name * - * @param {date} [options.body.lastSyncSuccess] Last Sync Success + * @param {date} [options.parameters.lastSyncSuccess] Last Sync Success * - * @param {string} [options.body.syncErrorState] Sync Error State + * @param {string} [options.parameters.syncErrorState] Sync Error State * - * @param {date} [options.body.syncErrorStateTimestamp] Sync Error State + * @param {date} [options.parameters.syncErrorStateTimestamp] Sync Error State * Timestamp * - * @param {string} [options.body.syncErrorDirection] Sync Error Direction. - * Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' + * @param {string} [options.parameters.syncErrorDirection] Sync Error + * Direction. Possible values include: 'none', 'initialize', 'download', + * 'upload', 'recall' * - * @param {number} [options.body.itemUploadErrorCount] Item Upload Error Count. + * @param {number} [options.parameters.itemUploadErrorCount] Item Upload Error + * Count. * - * @param {number} [options.body.itemDownloadErrorCount] Item download error - * count. + * @param {number} [options.parameters.itemDownloadErrorCount] Item download + * error count. * - * @param {string} [options.body.syncErrorContext] sync error context. + * @param {string} [options.parameters.syncErrorContext] sync error context. * - * @param {string} [options.body.currentProgressType] current progress type. - * Possible values include: 'none', 'initialize', 'download', 'upload', + * @param {string} [options.parameters.currentProgressType] current progress + * type. Possible values include: 'none', 'initialize', 'download', 'upload', * 'recall' * - * @param {number} [options.body.itemProgressCount] Item Progress Count + * @param {number} [options.parameters.itemProgressCount] Item Progress Count * - * @param {number} [options.body.itemTotalCount] Item Total Count + * @param {number} [options.parameters.itemTotalCount] Item Total Count * - * @param {number} [options.body.byteProgress] Bytes in progress + * @param {number} [options.parameters.byteProgress] Bytes in progress * - * @param {number} [options.body.totalProgress] Total progress + * @param {number} [options.parameters.totalProgress] Total progress * - * @param {number} [options.body.byteTotal] Bytes total + * @param {number} [options.parameters.byteTotal] Bytes total * - * @param {string} [options.body.serverResourceId] Server Resource Id. + * @param {string} [options.parameters.serverResourceId] Server Resource Id. * - * @param {string} [options.body.provisioningState] ServerEndpoint Provisioning - * State + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State * - * @param {string} [options.body.lastWorkflowId] ServerEndpoint lastWorkflowId + * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint + * lastWorkflowId * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -3088,9 +3152,9 @@ export interface ServerEndpoints { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginUpdate(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { body? : models.ServerEndpoint, customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdate(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { parameters? : models.ServerEndpoint, customHeaders? : { [headerName: string]: string; } }): Promise; beginUpdate(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, callback: ServiceCallback): void; - beginUpdate(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options: { body? : models.ServerEndpoint, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginUpdate(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options: { parameters? : models.ServerEndpoint, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -3383,34 +3447,34 @@ export interface RegisteredServers { * * @param {string} serverId GUID identifying the on-premises server. * - * @param {object} body Body of Registered Server object. + * @param {object} parameters Body of Registered Server object. * - * @param {string} [body.serverCertificate] Registered Server Certificate + * @param {string} [parameters.serverCertificate] Registered Server Certificate * - * @param {string} [body.agentVersion] Registered Server Agent Version + * @param {string} [parameters.agentVersion] Registered Server Agent Version * - * @param {string} [body.serverOSVersion] Registered Server OS Version + * @param {string} [parameters.serverOSVersion] Registered Server OS Version * - * @param {number} [body.serverManagementtErrorCode] Registered Server + * @param {number} [parameters.serverManagementtErrorCode] Registered Server * Management Error Code * - * @param {string} [body.lastHeartBeat] Registered Server last heart beat + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat * - * @param {string} [body.provisioningState] Registered Server Provisioning - * State + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State * - * @param {string} [body.serverRole] Registered Server serverRole + * @param {string} [parameters.serverRole] Registered Server serverRole * - * @param {string} [body.clusterId] Registered Server clusterId + * @param {string} [parameters.clusterId] Registered Server clusterId * - * @param {string} [body.clusterName] Registered Server clusterName + * @param {string} [parameters.clusterName] Registered Server clusterName * - * @param {string} [body.serverId] Registered Server serverId + * @param {string} [parameters.serverId] Registered Server serverId * - * @param {string} [body.storageSyncServiceUid] Registered Server + * @param {string} [parameters.storageSyncServiceUid] Registered Server * storageSyncServiceUid * - * @param {string} [body.lastWorkflowId] Registered Server lastWorkflowId + * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId * * @param {object} [options] Optional Parameters. * @@ -3423,7 +3487,7 @@ export interface RegisteredServers { * * @reject {Error|ServiceError} - The error object. */ - createWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, serverId: string, body: models.RegisteredServer, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, serverId: string, parameters: models.RegisteredServer, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Add a new registered server. @@ -3436,34 +3500,34 @@ export interface RegisteredServers { * * @param {string} serverId GUID identifying the on-premises server. * - * @param {object} body Body of Registered Server object. + * @param {object} parameters Body of Registered Server object. * - * @param {string} [body.serverCertificate] Registered Server Certificate + * @param {string} [parameters.serverCertificate] Registered Server Certificate * - * @param {string} [body.agentVersion] Registered Server Agent Version + * @param {string} [parameters.agentVersion] Registered Server Agent Version * - * @param {string} [body.serverOSVersion] Registered Server OS Version + * @param {string} [parameters.serverOSVersion] Registered Server OS Version * - * @param {number} [body.serverManagementtErrorCode] Registered Server + * @param {number} [parameters.serverManagementtErrorCode] Registered Server * Management Error Code * - * @param {string} [body.lastHeartBeat] Registered Server last heart beat + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat * - * @param {string} [body.provisioningState] Registered Server Provisioning - * State + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State * - * @param {string} [body.serverRole] Registered Server serverRole + * @param {string} [parameters.serverRole] Registered Server serverRole * - * @param {string} [body.clusterId] Registered Server clusterId + * @param {string} [parameters.clusterId] Registered Server clusterId * - * @param {string} [body.clusterName] Registered Server clusterName + * @param {string} [parameters.clusterName] Registered Server clusterName * - * @param {string} [body.serverId] Registered Server serverId + * @param {string} [parameters.serverId] Registered Server serverId * - * @param {string} [body.storageSyncServiceUid] Registered Server + * @param {string} [parameters.storageSyncServiceUid] Registered Server * storageSyncServiceUid * - * @param {string} [body.lastWorkflowId] Registered Server lastWorkflowId + * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId * * @param {object} [options] Optional Parameters. * @@ -3492,9 +3556,9 @@ export interface RegisteredServers { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - create(resourceGroupName: string, storageSyncServiceName: string, serverId: string, body: models.RegisteredServer, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - create(resourceGroupName: string, storageSyncServiceName: string, serverId: string, body: models.RegisteredServer, callback: ServiceCallback): void; - create(resourceGroupName: string, storageSyncServiceName: string, serverId: string, body: models.RegisteredServer, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + create(resourceGroupName: string, storageSyncServiceName: string, serverId: string, parameters: models.RegisteredServer, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, storageSyncServiceName: string, serverId: string, parameters: models.RegisteredServer, callback: ServiceCallback): void; + create(resourceGroupName: string, storageSyncServiceName: string, serverId: string, parameters: models.RegisteredServer, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -3574,34 +3638,34 @@ export interface RegisteredServers { * * @param {string} serverId GUID identifying the on-premises server. * - * @param {object} body Body of Registered Server object. + * @param {object} parameters Body of Registered Server object. * - * @param {string} [body.serverCertificate] Registered Server Certificate + * @param {string} [parameters.serverCertificate] Registered Server Certificate * - * @param {string} [body.agentVersion] Registered Server Agent Version + * @param {string} [parameters.agentVersion] Registered Server Agent Version * - * @param {string} [body.serverOSVersion] Registered Server OS Version + * @param {string} [parameters.serverOSVersion] Registered Server OS Version * - * @param {number} [body.serverManagementtErrorCode] Registered Server + * @param {number} [parameters.serverManagementtErrorCode] Registered Server * Management Error Code * - * @param {string} [body.lastHeartBeat] Registered Server last heart beat + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat * - * @param {string} [body.provisioningState] Registered Server Provisioning - * State + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State * - * @param {string} [body.serverRole] Registered Server serverRole + * @param {string} [parameters.serverRole] Registered Server serverRole * - * @param {string} [body.clusterId] Registered Server clusterId + * @param {string} [parameters.clusterId] Registered Server clusterId * - * @param {string} [body.clusterName] Registered Server clusterName + * @param {string} [parameters.clusterName] Registered Server clusterName * - * @param {string} [body.serverId] Registered Server serverId + * @param {string} [parameters.serverId] Registered Server serverId * - * @param {string} [body.storageSyncServiceUid] Registered Server + * @param {string} [parameters.storageSyncServiceUid] Registered Server * storageSyncServiceUid * - * @param {string} [body.lastWorkflowId] Registered Server lastWorkflowId + * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId * * @param {object} [options] Optional Parameters. * @@ -3614,7 +3678,7 @@ export interface RegisteredServers { * * @reject {Error|ServiceError} - The error object. */ - beginCreateWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, serverId: string, body: models.RegisteredServer, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginCreateWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, serverId: string, parameters: models.RegisteredServer, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Add a new registered server. @@ -3627,34 +3691,34 @@ export interface RegisteredServers { * * @param {string} serverId GUID identifying the on-premises server. * - * @param {object} body Body of Registered Server object. + * @param {object} parameters Body of Registered Server object. * - * @param {string} [body.serverCertificate] Registered Server Certificate + * @param {string} [parameters.serverCertificate] Registered Server Certificate * - * @param {string} [body.agentVersion] Registered Server Agent Version + * @param {string} [parameters.agentVersion] Registered Server Agent Version * - * @param {string} [body.serverOSVersion] Registered Server OS Version + * @param {string} [parameters.serverOSVersion] Registered Server OS Version * - * @param {number} [body.serverManagementtErrorCode] Registered Server + * @param {number} [parameters.serverManagementtErrorCode] Registered Server * Management Error Code * - * @param {string} [body.lastHeartBeat] Registered Server last heart beat + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat * - * @param {string} [body.provisioningState] Registered Server Provisioning - * State + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State * - * @param {string} [body.serverRole] Registered Server serverRole + * @param {string} [parameters.serverRole] Registered Server serverRole * - * @param {string} [body.clusterId] Registered Server clusterId + * @param {string} [parameters.clusterId] Registered Server clusterId * - * @param {string} [body.clusterName] Registered Server clusterName + * @param {string} [parameters.clusterName] Registered Server clusterName * - * @param {string} [body.serverId] Registered Server serverId + * @param {string} [parameters.serverId] Registered Server serverId * - * @param {string} [body.storageSyncServiceUid] Registered Server + * @param {string} [parameters.storageSyncServiceUid] Registered Server * storageSyncServiceUid * - * @param {string} [body.lastWorkflowId] Registered Server lastWorkflowId + * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId * * @param {object} [options] Optional Parameters. * @@ -3683,9 +3747,9 @@ export interface RegisteredServers { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginCreate(resourceGroupName: string, storageSyncServiceName: string, serverId: string, body: models.RegisteredServer, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginCreate(resourceGroupName: string, storageSyncServiceName: string, serverId: string, body: models.RegisteredServer, callback: ServiceCallback): void; - beginCreate(resourceGroupName: string, storageSyncServiceName: string, serverId: string, body: models.RegisteredServer, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginCreate(resourceGroupName: string, storageSyncServiceName: string, serverId: string, parameters: models.RegisteredServer, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreate(resourceGroupName: string, storageSyncServiceName: string, serverId: string, parameters: models.RegisteredServer, callback: ServiceCallback): void; + beginCreate(resourceGroupName: string, storageSyncServiceName: string, serverId: string, parameters: models.RegisteredServer, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** diff --git a/lib/services/storagesyncManagement/lib/operations/registeredServers.js b/lib/services/storagesyncManagement/lib/operations/registeredServers.js index f2c527ff98..9b73405de7 100644 --- a/lib/services/storagesyncManagement/lib/operations/registeredServers.js +++ b/lib/services/storagesyncManagement/lib/operations/registeredServers.js @@ -356,34 +356,34 @@ function _get(resourceGroupName, storageSyncServiceName, serverId, options, call * * @param {string} serverId GUID identifying the on-premises server. * - * @param {object} body Body of Registered Server object. + * @param {object} parameters Body of Registered Server object. * - * @param {string} [body.serverCertificate] Registered Server Certificate + * @param {string} [parameters.serverCertificate] Registered Server Certificate * - * @param {string} [body.agentVersion] Registered Server Agent Version + * @param {string} [parameters.agentVersion] Registered Server Agent Version * - * @param {string} [body.serverOSVersion] Registered Server OS Version + * @param {string} [parameters.serverOSVersion] Registered Server OS Version * - * @param {number} [body.serverManagementtErrorCode] Registered Server + * @param {number} [parameters.serverManagementtErrorCode] Registered Server * Management Error Code * - * @param {string} [body.lastHeartBeat] Registered Server last heart beat + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat * - * @param {string} [body.provisioningState] Registered Server Provisioning - * State + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State * - * @param {string} [body.serverRole] Registered Server serverRole + * @param {string} [parameters.serverRole] Registered Server serverRole * - * @param {string} [body.clusterId] Registered Server clusterId + * @param {string} [parameters.clusterId] Registered Server clusterId * - * @param {string} [body.clusterName] Registered Server clusterName + * @param {string} [parameters.clusterName] Registered Server clusterName * - * @param {string} [body.serverId] Registered Server serverId + * @param {string} [parameters.serverId] Registered Server serverId * - * @param {string} [body.storageSyncServiceUid] Registered Server + * @param {string} [parameters.storageSyncServiceUid] Registered Server * storageSyncServiceUid * - * @param {string} [body.lastWorkflowId] Registered Server lastWorkflowId + * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId * * @param {object} [options] Optional Parameters. * @@ -403,7 +403,7 @@ function _get(resourceGroupName, storageSyncServiceName, serverId, options, call * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _create(resourceGroupName, storageSyncServiceName, serverId, body, options, callback) { +function _create(resourceGroupName, storageSyncServiceName, serverId, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -416,7 +416,7 @@ function _create(resourceGroupName, storageSyncServiceName, serverId, body, opti } // Send request - this.beginCreate(resourceGroupName, storageSyncServiceName, serverId, body, options, (err, parsedResult, httpRequest, response) => { + this.beginCreate(resourceGroupName, storageSyncServiceName, serverId, parameters, options, (err, parsedResult, httpRequest, response) => { if (err) return callback(err); let initialResult = new msRest.HttpOperationResponse(); @@ -533,34 +533,34 @@ function _deleteMethod(resourceGroupName, storageSyncServiceName, serverId, opti * * @param {string} serverId GUID identifying the on-premises server. * - * @param {object} body Body of Registered Server object. + * @param {object} parameters Body of Registered Server object. * - * @param {string} [body.serverCertificate] Registered Server Certificate + * @param {string} [parameters.serverCertificate] Registered Server Certificate * - * @param {string} [body.agentVersion] Registered Server Agent Version + * @param {string} [parameters.agentVersion] Registered Server Agent Version * - * @param {string} [body.serverOSVersion] Registered Server OS Version + * @param {string} [parameters.serverOSVersion] Registered Server OS Version * - * @param {number} [body.serverManagementtErrorCode] Registered Server + * @param {number} [parameters.serverManagementtErrorCode] Registered Server * Management Error Code * - * @param {string} [body.lastHeartBeat] Registered Server last heart beat + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat * - * @param {string} [body.provisioningState] Registered Server Provisioning - * State + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State * - * @param {string} [body.serverRole] Registered Server serverRole + * @param {string} [parameters.serverRole] Registered Server serverRole * - * @param {string} [body.clusterId] Registered Server clusterId + * @param {string} [parameters.clusterId] Registered Server clusterId * - * @param {string} [body.clusterName] Registered Server clusterName + * @param {string} [parameters.clusterName] Registered Server clusterName * - * @param {string} [body.serverId] Registered Server serverId + * @param {string} [parameters.serverId] Registered Server serverId * - * @param {string} [body.storageSyncServiceUid] Registered Server + * @param {string} [parameters.storageSyncServiceUid] Registered Server * storageSyncServiceUid * - * @param {string} [body.lastWorkflowId] Registered Server lastWorkflowId + * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId * * @param {object} [options] Optional Parameters. * @@ -580,7 +580,7 @@ function _deleteMethod(resourceGroupName, storageSyncServiceName, serverId, opti * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _beginCreate(resourceGroupName, storageSyncServiceName, serverId, body, options, callback) { +function _beginCreate(resourceGroupName, storageSyncServiceName, serverId, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -621,8 +621,8 @@ function _beginCreate(resourceGroupName, storageSyncServiceName, serverId, body, if (serverId === null || serverId === undefined || typeof serverId.valueOf() !== 'string') { throw new Error('serverId cannot be null or undefined and it must be of type string.'); } - if (body === null || body === undefined) { - throw new Error('body cannot be null or undefined.'); + 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.'); @@ -668,14 +668,14 @@ function _beginCreate(resourceGroupName, storageSyncServiceName, serverId, body, let requestContent = null; let requestModel = null; try { - if (body !== null && body !== undefined) { + if (parameters !== null && parameters !== undefined) { let requestModelMapper = new client.models['RegisteredServer']().mapper(); - requestModel = client.serialize(requestModelMapper, body, 'body'); + 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(body, null, 2)}.`); + `payload - ${JSON.stringify(parameters, null, 2)}.`); return callback(serializationError); } httpRequest.body = requestContent; @@ -1097,34 +1097,34 @@ class RegisteredServers { * * @param {string} serverId GUID identifying the on-premises server. * - * @param {object} body Body of Registered Server object. + * @param {object} parameters Body of Registered Server object. * - * @param {string} [body.serverCertificate] Registered Server Certificate + * @param {string} [parameters.serverCertificate] Registered Server Certificate * - * @param {string} [body.agentVersion] Registered Server Agent Version + * @param {string} [parameters.agentVersion] Registered Server Agent Version * - * @param {string} [body.serverOSVersion] Registered Server OS Version + * @param {string} [parameters.serverOSVersion] Registered Server OS Version * - * @param {number} [body.serverManagementtErrorCode] Registered Server + * @param {number} [parameters.serverManagementtErrorCode] Registered Server * Management Error Code * - * @param {string} [body.lastHeartBeat] Registered Server last heart beat + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat * - * @param {string} [body.provisioningState] Registered Server Provisioning - * State + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State * - * @param {string} [body.serverRole] Registered Server serverRole + * @param {string} [parameters.serverRole] Registered Server serverRole * - * @param {string} [body.clusterId] Registered Server clusterId + * @param {string} [parameters.clusterId] Registered Server clusterId * - * @param {string} [body.clusterName] Registered Server clusterName + * @param {string} [parameters.clusterName] Registered Server clusterName * - * @param {string} [body.serverId] Registered Server serverId + * @param {string} [parameters.serverId] Registered Server serverId * - * @param {string} [body.storageSyncServiceUid] Registered Server + * @param {string} [parameters.storageSyncServiceUid] Registered Server * storageSyncServiceUid * - * @param {string} [body.lastWorkflowId] Registered Server lastWorkflowId + * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId * * @param {object} [options] Optional Parameters. * @@ -1137,11 +1137,11 @@ class RegisteredServers { * * @reject {Error} - The error object. */ - createWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, serverId, body, options) { + createWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, serverId, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._create(resourceGroupName, storageSyncServiceName, serverId, body, options, (err, result, request, response) => { + self._create(resourceGroupName, storageSyncServiceName, serverId, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1162,34 +1162,34 @@ class RegisteredServers { * * @param {string} serverId GUID identifying the on-premises server. * - * @param {object} body Body of Registered Server object. + * @param {object} parameters Body of Registered Server object. * - * @param {string} [body.serverCertificate] Registered Server Certificate + * @param {string} [parameters.serverCertificate] Registered Server Certificate * - * @param {string} [body.agentVersion] Registered Server Agent Version + * @param {string} [parameters.agentVersion] Registered Server Agent Version * - * @param {string} [body.serverOSVersion] Registered Server OS Version + * @param {string} [parameters.serverOSVersion] Registered Server OS Version * - * @param {number} [body.serverManagementtErrorCode] Registered Server + * @param {number} [parameters.serverManagementtErrorCode] Registered Server * Management Error Code * - * @param {string} [body.lastHeartBeat] Registered Server last heart beat + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat * - * @param {string} [body.provisioningState] Registered Server Provisioning - * State + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State * - * @param {string} [body.serverRole] Registered Server serverRole + * @param {string} [parameters.serverRole] Registered Server serverRole * - * @param {string} [body.clusterId] Registered Server clusterId + * @param {string} [parameters.clusterId] Registered Server clusterId * - * @param {string} [body.clusterName] Registered Server clusterName + * @param {string} [parameters.clusterName] Registered Server clusterName * - * @param {string} [body.serverId] Registered Server serverId + * @param {string} [parameters.serverId] Registered Server serverId * - * @param {string} [body.storageSyncServiceUid] Registered Server + * @param {string} [parameters.storageSyncServiceUid] Registered Server * storageSyncServiceUid * - * @param {string} [body.lastWorkflowId] Registered Server lastWorkflowId + * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId * * @param {object} [options] Optional Parameters. * @@ -1218,7 +1218,7 @@ class RegisteredServers { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - create(resourceGroupName, storageSyncServiceName, serverId, body, options, optionalCallback) { + create(resourceGroupName, storageSyncServiceName, serverId, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -1227,14 +1227,14 @@ class RegisteredServers { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._create(resourceGroupName, storageSyncServiceName, serverId, body, options, (err, result, request, response) => { + self._create(resourceGroupName, storageSyncServiceName, serverId, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._create(resourceGroupName, storageSyncServiceName, serverId, body, options, optionalCallback); + return self._create(resourceGroupName, storageSyncServiceName, serverId, parameters, options, optionalCallback); } } @@ -1342,34 +1342,34 @@ class RegisteredServers { * * @param {string} serverId GUID identifying the on-premises server. * - * @param {object} body Body of Registered Server object. + * @param {object} parameters Body of Registered Server object. * - * @param {string} [body.serverCertificate] Registered Server Certificate + * @param {string} [parameters.serverCertificate] Registered Server Certificate * - * @param {string} [body.agentVersion] Registered Server Agent Version + * @param {string} [parameters.agentVersion] Registered Server Agent Version * - * @param {string} [body.serverOSVersion] Registered Server OS Version + * @param {string} [parameters.serverOSVersion] Registered Server OS Version * - * @param {number} [body.serverManagementtErrorCode] Registered Server + * @param {number} [parameters.serverManagementtErrorCode] Registered Server * Management Error Code * - * @param {string} [body.lastHeartBeat] Registered Server last heart beat + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat * - * @param {string} [body.provisioningState] Registered Server Provisioning - * State + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State * - * @param {string} [body.serverRole] Registered Server serverRole + * @param {string} [parameters.serverRole] Registered Server serverRole * - * @param {string} [body.clusterId] Registered Server clusterId + * @param {string} [parameters.clusterId] Registered Server clusterId * - * @param {string} [body.clusterName] Registered Server clusterName + * @param {string} [parameters.clusterName] Registered Server clusterName * - * @param {string} [body.serverId] Registered Server serverId + * @param {string} [parameters.serverId] Registered Server serverId * - * @param {string} [body.storageSyncServiceUid] Registered Server + * @param {string} [parameters.storageSyncServiceUid] Registered Server * storageSyncServiceUid * - * @param {string} [body.lastWorkflowId] Registered Server lastWorkflowId + * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId * * @param {object} [options] Optional Parameters. * @@ -1382,11 +1382,11 @@ class RegisteredServers { * * @reject {Error} - The error object. */ - beginCreateWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, serverId, body, options) { + beginCreateWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, serverId, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._beginCreate(resourceGroupName, storageSyncServiceName, serverId, body, options, (err, result, request, response) => { + self._beginCreate(resourceGroupName, storageSyncServiceName, serverId, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1407,34 +1407,34 @@ class RegisteredServers { * * @param {string} serverId GUID identifying the on-premises server. * - * @param {object} body Body of Registered Server object. + * @param {object} parameters Body of Registered Server object. * - * @param {string} [body.serverCertificate] Registered Server Certificate + * @param {string} [parameters.serverCertificate] Registered Server Certificate * - * @param {string} [body.agentVersion] Registered Server Agent Version + * @param {string} [parameters.agentVersion] Registered Server Agent Version * - * @param {string} [body.serverOSVersion] Registered Server OS Version + * @param {string} [parameters.serverOSVersion] Registered Server OS Version * - * @param {number} [body.serverManagementtErrorCode] Registered Server + * @param {number} [parameters.serverManagementtErrorCode] Registered Server * Management Error Code * - * @param {string} [body.lastHeartBeat] Registered Server last heart beat + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat * - * @param {string} [body.provisioningState] Registered Server Provisioning - * State + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State * - * @param {string} [body.serverRole] Registered Server serverRole + * @param {string} [parameters.serverRole] Registered Server serverRole * - * @param {string} [body.clusterId] Registered Server clusterId + * @param {string} [parameters.clusterId] Registered Server clusterId * - * @param {string} [body.clusterName] Registered Server clusterName + * @param {string} [parameters.clusterName] Registered Server clusterName * - * @param {string} [body.serverId] Registered Server serverId + * @param {string} [parameters.serverId] Registered Server serverId * - * @param {string} [body.storageSyncServiceUid] Registered Server + * @param {string} [parameters.storageSyncServiceUid] Registered Server * storageSyncServiceUid * - * @param {string} [body.lastWorkflowId] Registered Server lastWorkflowId + * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId * * @param {object} [options] Optional Parameters. * @@ -1463,7 +1463,7 @@ class RegisteredServers { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - beginCreate(resourceGroupName, storageSyncServiceName, serverId, body, options, optionalCallback) { + beginCreate(resourceGroupName, storageSyncServiceName, serverId, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -1472,14 +1472,14 @@ class RegisteredServers { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._beginCreate(resourceGroupName, storageSyncServiceName, serverId, body, options, (err, result, request, response) => { + self._beginCreate(resourceGroupName, storageSyncServiceName, serverId, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._beginCreate(resourceGroupName, storageSyncServiceName, serverId, body, options, optionalCallback); + return self._beginCreate(resourceGroupName, storageSyncServiceName, serverId, parameters, options, optionalCallback); } } diff --git a/lib/services/storagesyncManagement/lib/operations/serverEndpoints.js b/lib/services/storagesyncManagement/lib/operations/serverEndpoints.js index a2785badf4..1798ad59c2 100644 --- a/lib/services/storagesyncManagement/lib/operations/serverEndpoints.js +++ b/lib/services/storagesyncManagement/lib/operations/serverEndpoints.js @@ -28,51 +28,56 @@ const WebResource = msRest.WebResource; * * @param {string} serverEndpointName Name of Server Endpoint object. * - * @param {object} body Body of Server Endpoint object. + * @param {object} parameters Body of Server Endpoint object. * - * @param {string} [body.serverLocalPath] Server Local path. + * @param {string} [parameters.serverLocalPath] Server Local path. * - * @param {string} [body.cloudTiering] Cloud Tiering. Possible values include: - * 'on', 'off' + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' * - * @param {number} [body.volumeFreeSpacePercent] Level of free space to be - * maintained by Cloud Tiering if it is enabled. + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. * - * @param {string} [body.friendlyName] Friendly Name + * @param {string} [parameters.friendlyName] Friendly Name * - * @param {date} [body.lastSyncSuccess] Last Sync Success + * @param {date} [parameters.lastSyncSuccess] Last Sync Success * - * @param {string} [body.syncErrorState] Sync Error State + * @param {string} [parameters.syncErrorState] Sync Error State * - * @param {date} [body.syncErrorStateTimestamp] Sync Error State Timestamp + * @param {date} [parameters.syncErrorStateTimestamp] Sync Error State + * Timestamp * - * @param {string} [body.syncErrorDirection] Sync Error Direction. Possible - * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * @param {string} [parameters.syncErrorDirection] Sync Error Direction. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' * - * @param {number} [body.itemUploadErrorCount] Item Upload Error Count. + * @param {number} [parameters.itemUploadErrorCount] Item Upload Error Count. * - * @param {number} [body.itemDownloadErrorCount] Item download error count. + * @param {number} [parameters.itemDownloadErrorCount] Item download error + * count. * - * @param {string} [body.syncErrorContext] sync error context. + * @param {string} [parameters.syncErrorContext] sync error context. * - * @param {string} [body.currentProgressType] current progress type. Possible - * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * @param {string} [parameters.currentProgressType] current progress type. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' * - * @param {number} [body.itemProgressCount] Item Progress Count + * @param {number} [parameters.itemProgressCount] Item Progress Count * - * @param {number} [body.itemTotalCount] Item Total Count + * @param {number} [parameters.itemTotalCount] Item Total Count * - * @param {number} [body.byteProgress] Bytes in progress + * @param {number} [parameters.byteProgress] Bytes in progress * - * @param {number} [body.totalProgress] Total progress + * @param {number} [parameters.totalProgress] Total progress * - * @param {number} [body.byteTotal] Bytes total + * @param {number} [parameters.byteTotal] Bytes total * - * @param {string} [body.serverResourceId] Server Resource Id. + * @param {string} [parameters.serverResourceId] Server Resource Id. * - * @param {string} [body.provisioningState] ServerEndpoint Provisioning State + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State * - * @param {string} [body.lastWorkflowId] ServerEndpoint lastWorkflowId + * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId * * @param {object} [options] Optional Parameters. * @@ -92,7 +97,7 @@ const WebResource = msRest.WebResource; * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _create(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, body, options, callback) { +function _create(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -105,7 +110,7 @@ function _create(resourceGroupName, storageSyncServiceName, syncGroupName, serve } // Send request - this.beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, body, options, (err, parsedResult, httpRequest, response) => { + this.beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, parameters, options, (err, parsedResult, httpRequest, response) => { if (err) return callback(err); let initialResult = new msRest.HttpOperationResponse(); @@ -160,57 +165,59 @@ function _create(resourceGroupName, storageSyncServiceName, syncGroupName, serve * * @param {object} [options] Optional Parameters. * - * @param {object} [options.body] Any of the properties applicable in PUT + * @param {object} [options.parameters] Any of the properties applicable in PUT * request. * - * @param {string} [options.body.serverLocalPath] Server Local path. + * @param {string} [options.parameters.serverLocalPath] Server Local path. * - * @param {string} [options.body.cloudTiering] Cloud Tiering. Possible values - * include: 'on', 'off' + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' * - * @param {number} [options.body.volumeFreeSpacePercent] Level of free space to - * be maintained by Cloud Tiering if it is enabled. + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. * - * @param {string} [options.body.friendlyName] Friendly Name + * @param {string} [options.parameters.friendlyName] Friendly Name * - * @param {date} [options.body.lastSyncSuccess] Last Sync Success + * @param {date} [options.parameters.lastSyncSuccess] Last Sync Success * - * @param {string} [options.body.syncErrorState] Sync Error State + * @param {string} [options.parameters.syncErrorState] Sync Error State * - * @param {date} [options.body.syncErrorStateTimestamp] Sync Error State + * @param {date} [options.parameters.syncErrorStateTimestamp] Sync Error State * Timestamp * - * @param {string} [options.body.syncErrorDirection] Sync Error Direction. - * Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' + * @param {string} [options.parameters.syncErrorDirection] Sync Error + * Direction. Possible values include: 'none', 'initialize', 'download', + * 'upload', 'recall' * - * @param {number} [options.body.itemUploadErrorCount] Item Upload Error Count. + * @param {number} [options.parameters.itemUploadErrorCount] Item Upload Error + * Count. * - * @param {number} [options.body.itemDownloadErrorCount] Item download error - * count. + * @param {number} [options.parameters.itemDownloadErrorCount] Item download + * error count. * - * @param {string} [options.body.syncErrorContext] sync error context. + * @param {string} [options.parameters.syncErrorContext] sync error context. * - * @param {string} [options.body.currentProgressType] current progress type. - * Possible values include: 'none', 'initialize', 'download', 'upload', + * @param {string} [options.parameters.currentProgressType] current progress + * type. Possible values include: 'none', 'initialize', 'download', 'upload', * 'recall' * - * @param {number} [options.body.itemProgressCount] Item Progress Count + * @param {number} [options.parameters.itemProgressCount] Item Progress Count * - * @param {number} [options.body.itemTotalCount] Item Total Count + * @param {number} [options.parameters.itemTotalCount] Item Total Count * - * @param {number} [options.body.byteProgress] Bytes in progress + * @param {number} [options.parameters.byteProgress] Bytes in progress * - * @param {number} [options.body.totalProgress] Total progress + * @param {number} [options.parameters.totalProgress] Total progress * - * @param {number} [options.body.byteTotal] Bytes total + * @param {number} [options.parameters.byteTotal] Bytes total * - * @param {string} [options.body.serverResourceId] Server Resource Id. + * @param {string} [options.parameters.serverResourceId] Server Resource Id. * - * @param {string} [options.body.provisioningState] ServerEndpoint Provisioning - * State + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State * - * @param {string} [options.body.lastWorkflowId] ServerEndpoint lastWorkflowId + * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint + * lastWorkflowId * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -773,51 +780,56 @@ function _recall(resourceGroupName, storageSyncServiceName, syncGroupName, serve * * @param {string} serverEndpointName Name of Server Endpoint object. * - * @param {object} body Body of Server Endpoint object. + * @param {object} parameters Body of Server Endpoint object. * - * @param {string} [body.serverLocalPath] Server Local path. + * @param {string} [parameters.serverLocalPath] Server Local path. * - * @param {string} [body.cloudTiering] Cloud Tiering. Possible values include: - * 'on', 'off' + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' * - * @param {number} [body.volumeFreeSpacePercent] Level of free space to be - * maintained by Cloud Tiering if it is enabled. + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. * - * @param {string} [body.friendlyName] Friendly Name + * @param {string} [parameters.friendlyName] Friendly Name * - * @param {date} [body.lastSyncSuccess] Last Sync Success + * @param {date} [parameters.lastSyncSuccess] Last Sync Success * - * @param {string} [body.syncErrorState] Sync Error State + * @param {string} [parameters.syncErrorState] Sync Error State * - * @param {date} [body.syncErrorStateTimestamp] Sync Error State Timestamp + * @param {date} [parameters.syncErrorStateTimestamp] Sync Error State + * Timestamp * - * @param {string} [body.syncErrorDirection] Sync Error Direction. Possible - * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * @param {string} [parameters.syncErrorDirection] Sync Error Direction. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' * - * @param {number} [body.itemUploadErrorCount] Item Upload Error Count. + * @param {number} [parameters.itemUploadErrorCount] Item Upload Error Count. * - * @param {number} [body.itemDownloadErrorCount] Item download error count. + * @param {number} [parameters.itemDownloadErrorCount] Item download error + * count. * - * @param {string} [body.syncErrorContext] sync error context. + * @param {string} [parameters.syncErrorContext] sync error context. * - * @param {string} [body.currentProgressType] current progress type. Possible - * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * @param {string} [parameters.currentProgressType] current progress type. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' * - * @param {number} [body.itemProgressCount] Item Progress Count + * @param {number} [parameters.itemProgressCount] Item Progress Count * - * @param {number} [body.itemTotalCount] Item Total Count + * @param {number} [parameters.itemTotalCount] Item Total Count * - * @param {number} [body.byteProgress] Bytes in progress + * @param {number} [parameters.byteProgress] Bytes in progress * - * @param {number} [body.totalProgress] Total progress + * @param {number} [parameters.totalProgress] Total progress * - * @param {number} [body.byteTotal] Bytes total + * @param {number} [parameters.byteTotal] Bytes total * - * @param {string} [body.serverResourceId] Server Resource Id. + * @param {string} [parameters.serverResourceId] Server Resource Id. * - * @param {string} [body.provisioningState] ServerEndpoint Provisioning State + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State * - * @param {string} [body.lastWorkflowId] ServerEndpoint lastWorkflowId + * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId * * @param {object} [options] Optional Parameters. * @@ -837,7 +849,7 @@ function _recall(resourceGroupName, storageSyncServiceName, syncGroupName, serve * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, body, options, callback) { +function _beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -881,8 +893,8 @@ function _beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, if (serverEndpointName === null || serverEndpointName === undefined || typeof serverEndpointName.valueOf() !== 'string') { throw new Error('serverEndpointName cannot be null or undefined and it must be of type string.'); } - if (body === null || body === undefined) { - throw new Error('body cannot be null or undefined.'); + 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.'); @@ -929,14 +941,14 @@ function _beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, let requestContent = null; let requestModel = null; try { - if (body !== null && body !== undefined) { + if (parameters !== null && parameters !== undefined) { let requestModelMapper = new client.models['ServerEndpoint']().mapper(); - requestModel = client.serialize(requestModelMapper, body, 'body'); + 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(body, null, 2)}.`); + `payload - ${JSON.stringify(parameters, null, 2)}.`); return callback(serializationError); } httpRequest.body = requestContent; @@ -1012,57 +1024,59 @@ function _beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, * * @param {object} [options] Optional Parameters. * - * @param {object} [options.body] Any of the properties applicable in PUT + * @param {object} [options.parameters] Any of the properties applicable in PUT * request. * - * @param {string} [options.body.serverLocalPath] Server Local path. + * @param {string} [options.parameters.serverLocalPath] Server Local path. * - * @param {string} [options.body.cloudTiering] Cloud Tiering. Possible values - * include: 'on', 'off' + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' * - * @param {number} [options.body.volumeFreeSpacePercent] Level of free space to - * be maintained by Cloud Tiering if it is enabled. + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. * - * @param {string} [options.body.friendlyName] Friendly Name + * @param {string} [options.parameters.friendlyName] Friendly Name * - * @param {date} [options.body.lastSyncSuccess] Last Sync Success + * @param {date} [options.parameters.lastSyncSuccess] Last Sync Success * - * @param {string} [options.body.syncErrorState] Sync Error State + * @param {string} [options.parameters.syncErrorState] Sync Error State * - * @param {date} [options.body.syncErrorStateTimestamp] Sync Error State + * @param {date} [options.parameters.syncErrorStateTimestamp] Sync Error State * Timestamp * - * @param {string} [options.body.syncErrorDirection] Sync Error Direction. - * Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' + * @param {string} [options.parameters.syncErrorDirection] Sync Error + * Direction. Possible values include: 'none', 'initialize', 'download', + * 'upload', 'recall' * - * @param {number} [options.body.itemUploadErrorCount] Item Upload Error Count. + * @param {number} [options.parameters.itemUploadErrorCount] Item Upload Error + * Count. * - * @param {number} [options.body.itemDownloadErrorCount] Item download error - * count. + * @param {number} [options.parameters.itemDownloadErrorCount] Item download + * error count. * - * @param {string} [options.body.syncErrorContext] sync error context. + * @param {string} [options.parameters.syncErrorContext] sync error context. * - * @param {string} [options.body.currentProgressType] current progress type. - * Possible values include: 'none', 'initialize', 'download', 'upload', + * @param {string} [options.parameters.currentProgressType] current progress + * type. Possible values include: 'none', 'initialize', 'download', 'upload', * 'recall' * - * @param {number} [options.body.itemProgressCount] Item Progress Count + * @param {number} [options.parameters.itemProgressCount] Item Progress Count * - * @param {number} [options.body.itemTotalCount] Item Total Count + * @param {number} [options.parameters.itemTotalCount] Item Total Count * - * @param {number} [options.body.byteProgress] Bytes in progress + * @param {number} [options.parameters.byteProgress] Bytes in progress * - * @param {number} [options.body.totalProgress] Total progress + * @param {number} [options.parameters.totalProgress] Total progress * - * @param {number} [options.body.byteTotal] Bytes total + * @param {number} [options.parameters.byteTotal] Bytes total * - * @param {string} [options.body.serverResourceId] Server Resource Id. + * @param {string} [options.parameters.serverResourceId] Server Resource Id. * - * @param {string} [options.body.provisioningState] ServerEndpoint Provisioning - * State + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State * - * @param {string} [options.body.lastWorkflowId] ServerEndpoint lastWorkflowId + * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint + * lastWorkflowId * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -1090,7 +1104,7 @@ function _beginUpdate(resourceGroupName, storageSyncServiceName, syncGroupName, if (!callback) { throw new Error('callback cannot be null.'); } - let body = (options && options.body !== undefined) ? options.body : undefined; + let parameters = (options && options.parameters !== undefined) ? options.parameters : undefined; // Validate try { if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { @@ -1170,14 +1184,14 @@ function _beginUpdate(resourceGroupName, storageSyncServiceName, syncGroupName, let requestContent = null; let requestModel = null; try { - if (body !== null && body !== undefined) { + if (parameters !== null && parameters !== undefined) { let requestModelMapper = new client.models['ServerEndpoint']().mapper(); - requestModel = client.serialize(requestModelMapper, body, 'body'); + 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(body, null, 2)}.`); + `payload - ${JSON.stringify(parameters, null, 2)}.`); return callback(serializationError); } httpRequest.body = requestContent; @@ -1583,51 +1597,56 @@ class ServerEndpoints { * * @param {string} serverEndpointName Name of Server Endpoint object. * - * @param {object} body Body of Server Endpoint object. + * @param {object} parameters Body of Server Endpoint object. * - * @param {string} [body.serverLocalPath] Server Local path. + * @param {string} [parameters.serverLocalPath] Server Local path. * - * @param {string} [body.cloudTiering] Cloud Tiering. Possible values include: - * 'on', 'off' + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' * - * @param {number} [body.volumeFreeSpacePercent] Level of free space to be - * maintained by Cloud Tiering if it is enabled. + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. * - * @param {string} [body.friendlyName] Friendly Name + * @param {string} [parameters.friendlyName] Friendly Name * - * @param {date} [body.lastSyncSuccess] Last Sync Success + * @param {date} [parameters.lastSyncSuccess] Last Sync Success * - * @param {string} [body.syncErrorState] Sync Error State + * @param {string} [parameters.syncErrorState] Sync Error State * - * @param {date} [body.syncErrorStateTimestamp] Sync Error State Timestamp + * @param {date} [parameters.syncErrorStateTimestamp] Sync Error State + * Timestamp * - * @param {string} [body.syncErrorDirection] Sync Error Direction. Possible - * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * @param {string} [parameters.syncErrorDirection] Sync Error Direction. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' * - * @param {number} [body.itemUploadErrorCount] Item Upload Error Count. + * @param {number} [parameters.itemUploadErrorCount] Item Upload Error Count. * - * @param {number} [body.itemDownloadErrorCount] Item download error count. + * @param {number} [parameters.itemDownloadErrorCount] Item download error + * count. * - * @param {string} [body.syncErrorContext] sync error context. + * @param {string} [parameters.syncErrorContext] sync error context. * - * @param {string} [body.currentProgressType] current progress type. Possible - * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * @param {string} [parameters.currentProgressType] current progress type. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' * - * @param {number} [body.itemProgressCount] Item Progress Count + * @param {number} [parameters.itemProgressCount] Item Progress Count * - * @param {number} [body.itemTotalCount] Item Total Count + * @param {number} [parameters.itemTotalCount] Item Total Count * - * @param {number} [body.byteProgress] Bytes in progress + * @param {number} [parameters.byteProgress] Bytes in progress * - * @param {number} [body.totalProgress] Total progress + * @param {number} [parameters.totalProgress] Total progress * - * @param {number} [body.byteTotal] Bytes total + * @param {number} [parameters.byteTotal] Bytes total * - * @param {string} [body.serverResourceId] Server Resource Id. + * @param {string} [parameters.serverResourceId] Server Resource Id. * - * @param {string} [body.provisioningState] ServerEndpoint Provisioning State + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State * - * @param {string} [body.lastWorkflowId] ServerEndpoint lastWorkflowId + * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId * * @param {object} [options] Optional Parameters. * @@ -1640,11 +1659,11 @@ class ServerEndpoints { * * @reject {Error} - The error object. */ - createWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, body, options) { + createWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._create(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, body, options, (err, result, request, response) => { + self._create(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1667,51 +1686,56 @@ class ServerEndpoints { * * @param {string} serverEndpointName Name of Server Endpoint object. * - * @param {object} body Body of Server Endpoint object. + * @param {object} parameters Body of Server Endpoint object. * - * @param {string} [body.serverLocalPath] Server Local path. + * @param {string} [parameters.serverLocalPath] Server Local path. * - * @param {string} [body.cloudTiering] Cloud Tiering. Possible values include: - * 'on', 'off' + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' * - * @param {number} [body.volumeFreeSpacePercent] Level of free space to be - * maintained by Cloud Tiering if it is enabled. + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. * - * @param {string} [body.friendlyName] Friendly Name + * @param {string} [parameters.friendlyName] Friendly Name * - * @param {date} [body.lastSyncSuccess] Last Sync Success + * @param {date} [parameters.lastSyncSuccess] Last Sync Success * - * @param {string} [body.syncErrorState] Sync Error State + * @param {string} [parameters.syncErrorState] Sync Error State * - * @param {date} [body.syncErrorStateTimestamp] Sync Error State Timestamp + * @param {date} [parameters.syncErrorStateTimestamp] Sync Error State + * Timestamp * - * @param {string} [body.syncErrorDirection] Sync Error Direction. Possible - * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * @param {string} [parameters.syncErrorDirection] Sync Error Direction. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' * - * @param {number} [body.itemUploadErrorCount] Item Upload Error Count. + * @param {number} [parameters.itemUploadErrorCount] Item Upload Error Count. * - * @param {number} [body.itemDownloadErrorCount] Item download error count. + * @param {number} [parameters.itemDownloadErrorCount] Item download error + * count. * - * @param {string} [body.syncErrorContext] sync error context. + * @param {string} [parameters.syncErrorContext] sync error context. * - * @param {string} [body.currentProgressType] current progress type. Possible - * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * @param {string} [parameters.currentProgressType] current progress type. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' * - * @param {number} [body.itemProgressCount] Item Progress Count + * @param {number} [parameters.itemProgressCount] Item Progress Count * - * @param {number} [body.itemTotalCount] Item Total Count + * @param {number} [parameters.itemTotalCount] Item Total Count * - * @param {number} [body.byteProgress] Bytes in progress + * @param {number} [parameters.byteProgress] Bytes in progress * - * @param {number} [body.totalProgress] Total progress + * @param {number} [parameters.totalProgress] Total progress * - * @param {number} [body.byteTotal] Bytes total + * @param {number} [parameters.byteTotal] Bytes total * - * @param {string} [body.serverResourceId] Server Resource Id. + * @param {string} [parameters.serverResourceId] Server Resource Id. * - * @param {string} [body.provisioningState] ServerEndpoint Provisioning State + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State * - * @param {string} [body.lastWorkflowId] ServerEndpoint lastWorkflowId + * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId * * @param {object} [options] Optional Parameters. * @@ -1740,7 +1764,7 @@ class ServerEndpoints { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - create(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, body, options, optionalCallback) { + create(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -1749,14 +1773,14 @@ class ServerEndpoints { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._create(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, body, options, (err, result, request, response) => { + self._create(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._create(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, body, options, optionalCallback); + return self._create(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, parameters, options, optionalCallback); } } @@ -1775,57 +1799,59 @@ class ServerEndpoints { * * @param {object} [options] Optional Parameters. * - * @param {object} [options.body] Any of the properties applicable in PUT + * @param {object} [options.parameters] Any of the properties applicable in PUT * request. * - * @param {string} [options.body.serverLocalPath] Server Local path. + * @param {string} [options.parameters.serverLocalPath] Server Local path. * - * @param {string} [options.body.cloudTiering] Cloud Tiering. Possible values - * include: 'on', 'off' + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' * - * @param {number} [options.body.volumeFreeSpacePercent] Level of free space to - * be maintained by Cloud Tiering if it is enabled. + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. * - * @param {string} [options.body.friendlyName] Friendly Name + * @param {string} [options.parameters.friendlyName] Friendly Name * - * @param {date} [options.body.lastSyncSuccess] Last Sync Success + * @param {date} [options.parameters.lastSyncSuccess] Last Sync Success * - * @param {string} [options.body.syncErrorState] Sync Error State + * @param {string} [options.parameters.syncErrorState] Sync Error State * - * @param {date} [options.body.syncErrorStateTimestamp] Sync Error State + * @param {date} [options.parameters.syncErrorStateTimestamp] Sync Error State * Timestamp * - * @param {string} [options.body.syncErrorDirection] Sync Error Direction. - * Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' + * @param {string} [options.parameters.syncErrorDirection] Sync Error + * Direction. Possible values include: 'none', 'initialize', 'download', + * 'upload', 'recall' * - * @param {number} [options.body.itemUploadErrorCount] Item Upload Error Count. + * @param {number} [options.parameters.itemUploadErrorCount] Item Upload Error + * Count. * - * @param {number} [options.body.itemDownloadErrorCount] Item download error - * count. + * @param {number} [options.parameters.itemDownloadErrorCount] Item download + * error count. * - * @param {string} [options.body.syncErrorContext] sync error context. + * @param {string} [options.parameters.syncErrorContext] sync error context. * - * @param {string} [options.body.currentProgressType] current progress type. - * Possible values include: 'none', 'initialize', 'download', 'upload', + * @param {string} [options.parameters.currentProgressType] current progress + * type. Possible values include: 'none', 'initialize', 'download', 'upload', * 'recall' * - * @param {number} [options.body.itemProgressCount] Item Progress Count + * @param {number} [options.parameters.itemProgressCount] Item Progress Count * - * @param {number} [options.body.itemTotalCount] Item Total Count + * @param {number} [options.parameters.itemTotalCount] Item Total Count * - * @param {number} [options.body.byteProgress] Bytes in progress + * @param {number} [options.parameters.byteProgress] Bytes in progress * - * @param {number} [options.body.totalProgress] Total progress + * @param {number} [options.parameters.totalProgress] Total progress * - * @param {number} [options.body.byteTotal] Bytes total + * @param {number} [options.parameters.byteTotal] Bytes total * - * @param {string} [options.body.serverResourceId] Server Resource Id. + * @param {string} [options.parameters.serverResourceId] Server Resource Id. * - * @param {string} [options.body.provisioningState] ServerEndpoint Provisioning - * State + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State * - * @param {string} [options.body.lastWorkflowId] ServerEndpoint lastWorkflowId + * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint + * lastWorkflowId * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -1865,57 +1891,59 @@ class ServerEndpoints { * * @param {object} [options] Optional Parameters. * - * @param {object} [options.body] Any of the properties applicable in PUT + * @param {object} [options.parameters] Any of the properties applicable in PUT * request. * - * @param {string} [options.body.serverLocalPath] Server Local path. + * @param {string} [options.parameters.serverLocalPath] Server Local path. * - * @param {string} [options.body.cloudTiering] Cloud Tiering. Possible values - * include: 'on', 'off' + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' * - * @param {number} [options.body.volumeFreeSpacePercent] Level of free space to - * be maintained by Cloud Tiering if it is enabled. + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. * - * @param {string} [options.body.friendlyName] Friendly Name + * @param {string} [options.parameters.friendlyName] Friendly Name * - * @param {date} [options.body.lastSyncSuccess] Last Sync Success + * @param {date} [options.parameters.lastSyncSuccess] Last Sync Success * - * @param {string} [options.body.syncErrorState] Sync Error State + * @param {string} [options.parameters.syncErrorState] Sync Error State * - * @param {date} [options.body.syncErrorStateTimestamp] Sync Error State + * @param {date} [options.parameters.syncErrorStateTimestamp] Sync Error State * Timestamp * - * @param {string} [options.body.syncErrorDirection] Sync Error Direction. - * Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' + * @param {string} [options.parameters.syncErrorDirection] Sync Error + * Direction. Possible values include: 'none', 'initialize', 'download', + * 'upload', 'recall' * - * @param {number} [options.body.itemUploadErrorCount] Item Upload Error Count. + * @param {number} [options.parameters.itemUploadErrorCount] Item Upload Error + * Count. * - * @param {number} [options.body.itemDownloadErrorCount] Item download error - * count. + * @param {number} [options.parameters.itemDownloadErrorCount] Item download + * error count. * - * @param {string} [options.body.syncErrorContext] sync error context. + * @param {string} [options.parameters.syncErrorContext] sync error context. * - * @param {string} [options.body.currentProgressType] current progress type. - * Possible values include: 'none', 'initialize', 'download', 'upload', + * @param {string} [options.parameters.currentProgressType] current progress + * type. Possible values include: 'none', 'initialize', 'download', 'upload', * 'recall' * - * @param {number} [options.body.itemProgressCount] Item Progress Count + * @param {number} [options.parameters.itemProgressCount] Item Progress Count * - * @param {number} [options.body.itemTotalCount] Item Total Count + * @param {number} [options.parameters.itemTotalCount] Item Total Count * - * @param {number} [options.body.byteProgress] Bytes in progress + * @param {number} [options.parameters.byteProgress] Bytes in progress * - * @param {number} [options.body.totalProgress] Total progress + * @param {number} [options.parameters.totalProgress] Total progress * - * @param {number} [options.body.byteTotal] Bytes total + * @param {number} [options.parameters.byteTotal] Bytes total * - * @param {string} [options.body.serverResourceId] Server Resource Id. + * @param {string} [options.parameters.serverResourceId] Server Resource Id. * - * @param {string} [options.body.provisioningState] ServerEndpoint Provisioning - * State + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State * - * @param {string} [options.body.lastWorkflowId] ServerEndpoint lastWorkflowId + * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint + * lastWorkflowId * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -2361,51 +2389,56 @@ class ServerEndpoints { * * @param {string} serverEndpointName Name of Server Endpoint object. * - * @param {object} body Body of Server Endpoint object. + * @param {object} parameters Body of Server Endpoint object. * - * @param {string} [body.serverLocalPath] Server Local path. + * @param {string} [parameters.serverLocalPath] Server Local path. * - * @param {string} [body.cloudTiering] Cloud Tiering. Possible values include: - * 'on', 'off' + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' * - * @param {number} [body.volumeFreeSpacePercent] Level of free space to be - * maintained by Cloud Tiering if it is enabled. + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. * - * @param {string} [body.friendlyName] Friendly Name + * @param {string} [parameters.friendlyName] Friendly Name * - * @param {date} [body.lastSyncSuccess] Last Sync Success + * @param {date} [parameters.lastSyncSuccess] Last Sync Success * - * @param {string} [body.syncErrorState] Sync Error State + * @param {string} [parameters.syncErrorState] Sync Error State * - * @param {date} [body.syncErrorStateTimestamp] Sync Error State Timestamp + * @param {date} [parameters.syncErrorStateTimestamp] Sync Error State + * Timestamp * - * @param {string} [body.syncErrorDirection] Sync Error Direction. Possible - * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * @param {string} [parameters.syncErrorDirection] Sync Error Direction. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' * - * @param {number} [body.itemUploadErrorCount] Item Upload Error Count. + * @param {number} [parameters.itemUploadErrorCount] Item Upload Error Count. * - * @param {number} [body.itemDownloadErrorCount] Item download error count. + * @param {number} [parameters.itemDownloadErrorCount] Item download error + * count. * - * @param {string} [body.syncErrorContext] sync error context. + * @param {string} [parameters.syncErrorContext] sync error context. * - * @param {string} [body.currentProgressType] current progress type. Possible - * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * @param {string} [parameters.currentProgressType] current progress type. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' * - * @param {number} [body.itemProgressCount] Item Progress Count + * @param {number} [parameters.itemProgressCount] Item Progress Count * - * @param {number} [body.itemTotalCount] Item Total Count + * @param {number} [parameters.itemTotalCount] Item Total Count * - * @param {number} [body.byteProgress] Bytes in progress + * @param {number} [parameters.byteProgress] Bytes in progress * - * @param {number} [body.totalProgress] Total progress + * @param {number} [parameters.totalProgress] Total progress * - * @param {number} [body.byteTotal] Bytes total + * @param {number} [parameters.byteTotal] Bytes total * - * @param {string} [body.serverResourceId] Server Resource Id. + * @param {string} [parameters.serverResourceId] Server Resource Id. * - * @param {string} [body.provisioningState] ServerEndpoint Provisioning State + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State * - * @param {string} [body.lastWorkflowId] ServerEndpoint lastWorkflowId + * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId * * @param {object} [options] Optional Parameters. * @@ -2418,11 +2451,11 @@ class ServerEndpoints { * * @reject {Error} - The error object. */ - beginCreateWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, body, options) { + beginCreateWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, body, options, (err, result, request, response) => { + self._beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -2445,51 +2478,56 @@ class ServerEndpoints { * * @param {string} serverEndpointName Name of Server Endpoint object. * - * @param {object} body Body of Server Endpoint object. + * @param {object} parameters Body of Server Endpoint object. * - * @param {string} [body.serverLocalPath] Server Local path. + * @param {string} [parameters.serverLocalPath] Server Local path. * - * @param {string} [body.cloudTiering] Cloud Tiering. Possible values include: - * 'on', 'off' + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' * - * @param {number} [body.volumeFreeSpacePercent] Level of free space to be - * maintained by Cloud Tiering if it is enabled. + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. * - * @param {string} [body.friendlyName] Friendly Name + * @param {string} [parameters.friendlyName] Friendly Name * - * @param {date} [body.lastSyncSuccess] Last Sync Success + * @param {date} [parameters.lastSyncSuccess] Last Sync Success * - * @param {string} [body.syncErrorState] Sync Error State + * @param {string} [parameters.syncErrorState] Sync Error State * - * @param {date} [body.syncErrorStateTimestamp] Sync Error State Timestamp + * @param {date} [parameters.syncErrorStateTimestamp] Sync Error State + * Timestamp * - * @param {string} [body.syncErrorDirection] Sync Error Direction. Possible - * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * @param {string} [parameters.syncErrorDirection] Sync Error Direction. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' * - * @param {number} [body.itemUploadErrorCount] Item Upload Error Count. + * @param {number} [parameters.itemUploadErrorCount] Item Upload Error Count. * - * @param {number} [body.itemDownloadErrorCount] Item download error count. + * @param {number} [parameters.itemDownloadErrorCount] Item download error + * count. * - * @param {string} [body.syncErrorContext] sync error context. + * @param {string} [parameters.syncErrorContext] sync error context. * - * @param {string} [body.currentProgressType] current progress type. Possible - * values include: 'none', 'initialize', 'download', 'upload', 'recall' + * @param {string} [parameters.currentProgressType] current progress type. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' * - * @param {number} [body.itemProgressCount] Item Progress Count + * @param {number} [parameters.itemProgressCount] Item Progress Count * - * @param {number} [body.itemTotalCount] Item Total Count + * @param {number} [parameters.itemTotalCount] Item Total Count * - * @param {number} [body.byteProgress] Bytes in progress + * @param {number} [parameters.byteProgress] Bytes in progress * - * @param {number} [body.totalProgress] Total progress + * @param {number} [parameters.totalProgress] Total progress * - * @param {number} [body.byteTotal] Bytes total + * @param {number} [parameters.byteTotal] Bytes total * - * @param {string} [body.serverResourceId] Server Resource Id. + * @param {string} [parameters.serverResourceId] Server Resource Id. * - * @param {string} [body.provisioningState] ServerEndpoint Provisioning State + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State * - * @param {string} [body.lastWorkflowId] ServerEndpoint lastWorkflowId + * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId * * @param {object} [options] Optional Parameters. * @@ -2518,7 +2556,7 @@ class ServerEndpoints { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, body, options, optionalCallback) { + beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -2527,14 +2565,14 @@ class ServerEndpoints { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, body, options, (err, result, request, response) => { + self._beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, body, options, optionalCallback); + return self._beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, parameters, options, optionalCallback); } } @@ -2553,57 +2591,59 @@ class ServerEndpoints { * * @param {object} [options] Optional Parameters. * - * @param {object} [options.body] Any of the properties applicable in PUT + * @param {object} [options.parameters] Any of the properties applicable in PUT * request. * - * @param {string} [options.body.serverLocalPath] Server Local path. + * @param {string} [options.parameters.serverLocalPath] Server Local path. * - * @param {string} [options.body.cloudTiering] Cloud Tiering. Possible values - * include: 'on', 'off' + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' * - * @param {number} [options.body.volumeFreeSpacePercent] Level of free space to - * be maintained by Cloud Tiering if it is enabled. + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. * - * @param {string} [options.body.friendlyName] Friendly Name + * @param {string} [options.parameters.friendlyName] Friendly Name * - * @param {date} [options.body.lastSyncSuccess] Last Sync Success + * @param {date} [options.parameters.lastSyncSuccess] Last Sync Success * - * @param {string} [options.body.syncErrorState] Sync Error State + * @param {string} [options.parameters.syncErrorState] Sync Error State * - * @param {date} [options.body.syncErrorStateTimestamp] Sync Error State + * @param {date} [options.parameters.syncErrorStateTimestamp] Sync Error State * Timestamp * - * @param {string} [options.body.syncErrorDirection] Sync Error Direction. - * Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' + * @param {string} [options.parameters.syncErrorDirection] Sync Error + * Direction. Possible values include: 'none', 'initialize', 'download', + * 'upload', 'recall' * - * @param {number} [options.body.itemUploadErrorCount] Item Upload Error Count. + * @param {number} [options.parameters.itemUploadErrorCount] Item Upload Error + * Count. * - * @param {number} [options.body.itemDownloadErrorCount] Item download error - * count. + * @param {number} [options.parameters.itemDownloadErrorCount] Item download + * error count. * - * @param {string} [options.body.syncErrorContext] sync error context. + * @param {string} [options.parameters.syncErrorContext] sync error context. * - * @param {string} [options.body.currentProgressType] current progress type. - * Possible values include: 'none', 'initialize', 'download', 'upload', + * @param {string} [options.parameters.currentProgressType] current progress + * type. Possible values include: 'none', 'initialize', 'download', 'upload', * 'recall' * - * @param {number} [options.body.itemProgressCount] Item Progress Count + * @param {number} [options.parameters.itemProgressCount] Item Progress Count * - * @param {number} [options.body.itemTotalCount] Item Total Count + * @param {number} [options.parameters.itemTotalCount] Item Total Count * - * @param {number} [options.body.byteProgress] Bytes in progress + * @param {number} [options.parameters.byteProgress] Bytes in progress * - * @param {number} [options.body.totalProgress] Total progress + * @param {number} [options.parameters.totalProgress] Total progress * - * @param {number} [options.body.byteTotal] Bytes total + * @param {number} [options.parameters.byteTotal] Bytes total * - * @param {string} [options.body.serverResourceId] Server Resource Id. + * @param {string} [options.parameters.serverResourceId] Server Resource Id. * - * @param {string} [options.body.provisioningState] ServerEndpoint Provisioning - * State + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State * - * @param {string} [options.body.lastWorkflowId] ServerEndpoint lastWorkflowId + * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint + * lastWorkflowId * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -2643,57 +2683,59 @@ class ServerEndpoints { * * @param {object} [options] Optional Parameters. * - * @param {object} [options.body] Any of the properties applicable in PUT + * @param {object} [options.parameters] Any of the properties applicable in PUT * request. * - * @param {string} [options.body.serverLocalPath] Server Local path. + * @param {string} [options.parameters.serverLocalPath] Server Local path. * - * @param {string} [options.body.cloudTiering] Cloud Tiering. Possible values - * include: 'on', 'off' + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' * - * @param {number} [options.body.volumeFreeSpacePercent] Level of free space to - * be maintained by Cloud Tiering if it is enabled. + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. * - * @param {string} [options.body.friendlyName] Friendly Name + * @param {string} [options.parameters.friendlyName] Friendly Name * - * @param {date} [options.body.lastSyncSuccess] Last Sync Success + * @param {date} [options.parameters.lastSyncSuccess] Last Sync Success * - * @param {string} [options.body.syncErrorState] Sync Error State + * @param {string} [options.parameters.syncErrorState] Sync Error State * - * @param {date} [options.body.syncErrorStateTimestamp] Sync Error State + * @param {date} [options.parameters.syncErrorStateTimestamp] Sync Error State * Timestamp * - * @param {string} [options.body.syncErrorDirection] Sync Error Direction. - * Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' + * @param {string} [options.parameters.syncErrorDirection] Sync Error + * Direction. Possible values include: 'none', 'initialize', 'download', + * 'upload', 'recall' * - * @param {number} [options.body.itemUploadErrorCount] Item Upload Error Count. + * @param {number} [options.parameters.itemUploadErrorCount] Item Upload Error + * Count. * - * @param {number} [options.body.itemDownloadErrorCount] Item download error - * count. + * @param {number} [options.parameters.itemDownloadErrorCount] Item download + * error count. * - * @param {string} [options.body.syncErrorContext] sync error context. + * @param {string} [options.parameters.syncErrorContext] sync error context. * - * @param {string} [options.body.currentProgressType] current progress type. - * Possible values include: 'none', 'initialize', 'download', 'upload', + * @param {string} [options.parameters.currentProgressType] current progress + * type. Possible values include: 'none', 'initialize', 'download', 'upload', * 'recall' * - * @param {number} [options.body.itemProgressCount] Item Progress Count + * @param {number} [options.parameters.itemProgressCount] Item Progress Count * - * @param {number} [options.body.itemTotalCount] Item Total Count + * @param {number} [options.parameters.itemTotalCount] Item Total Count * - * @param {number} [options.body.byteProgress] Bytes in progress + * @param {number} [options.parameters.byteProgress] Bytes in progress * - * @param {number} [options.body.totalProgress] Total progress + * @param {number} [options.parameters.totalProgress] Total progress * - * @param {number} [options.body.byteTotal] Bytes total + * @param {number} [options.parameters.byteTotal] Bytes total * - * @param {string} [options.body.serverResourceId] Server Resource Id. + * @param {string} [options.parameters.serverResourceId] Server Resource Id. * - * @param {string} [options.body.provisioningState] ServerEndpoint Provisioning - * State + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State * - * @param {string} [options.body.lastWorkflowId] ServerEndpoint lastWorkflowId + * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint + * lastWorkflowId * * @param {object} [options.customHeaders] Headers that will be added to the * request diff --git a/lib/services/storagesyncManagement/lib/operations/storageSyncServices.js b/lib/services/storagesyncManagement/lib/operations/storageSyncServices.js index 2578b3559d..d1bbc819bb 100644 --- a/lib/services/storagesyncManagement/lib/operations/storageSyncServices.js +++ b/lib/services/storagesyncManagement/lib/operations/storageSyncServices.js @@ -23,7 +23,7 @@ const WebResource = msRest.WebResource; * @param {string} storageSyncServiceName Name of Storage Sync Service * resource. * - * @param {object} body Storage Sync Service resource name. + * @param {object} parameters Storage Sync Service resource name. * * @param {object} [options] Optional Parameters. * @@ -43,7 +43,7 @@ const WebResource = msRest.WebResource; * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _create(resourceGroupName, storageSyncServiceName, body, options, callback) { +function _create(resourceGroupName, storageSyncServiceName, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -81,8 +81,8 @@ function _create(resourceGroupName, storageSyncServiceName, body, options, callb if (storageSyncServiceName === null || storageSyncServiceName === undefined || typeof storageSyncServiceName.valueOf() !== 'string') { throw new Error('storageSyncServiceName cannot be null or undefined and it must be of type string.'); } - if (body === null || body === undefined) { - throw new Error('body cannot be null or undefined.'); + 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.'); @@ -127,14 +127,14 @@ function _create(resourceGroupName, storageSyncServiceName, body, options, callb let requestContent = null; let requestModel = null; try { - if (body !== null && body !== undefined) { + if (parameters !== null && parameters !== undefined) { let requestModelMapper = new client.models['StorageSyncService']().mapper(); - requestModel = client.serialize(requestModelMapper, body, 'body'); + 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(body, null, 2)}.`); + `payload - ${JSON.stringify(parameters, null, 2)}.`); return callback(serializationError); } httpRequest.body = requestContent; @@ -368,7 +368,7 @@ function _get(resourceGroupName, storageSyncServiceName, options, callback) { * * @param {object} [options] Optional Parameters. * - * @param {object} [options.body] Storage Sync Service resource. + * @param {object} [options.parameters] Storage Sync Service resource. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -396,7 +396,7 @@ function _update(resourceGroupName, storageSyncServiceName, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let body = (options && options.body !== undefined) ? options.body : undefined; + let parameters = (options && options.parameters !== undefined) ? options.parameters : undefined; // Validate try { if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { @@ -468,14 +468,14 @@ function _update(resourceGroupName, storageSyncServiceName, options, callback) { let requestContent = null; let requestModel = null; try { - if (body !== null && body !== undefined) { + if (parameters !== null && parameters !== undefined) { let requestModelMapper = new client.models['StorageSyncService']().mapper(); - requestModel = client.serialize(requestModelMapper, body, 'body'); + 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(body, null, 2)}.`); + `payload - ${JSON.stringify(parameters, null, 2)}.`); return callback(serializationError); } httpRequest.body = requestContent; @@ -996,7 +996,7 @@ class StorageSyncServices { * @param {string} storageSyncServiceName Name of Storage Sync Service * resource. * - * @param {object} body Storage Sync Service resource name. + * @param {object} parameters Storage Sync Service resource name. * * @param {object} [options] Optional Parameters. * @@ -1009,11 +1009,11 @@ class StorageSyncServices { * * @reject {Error} - The error object. */ - createWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, body, options) { + createWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._create(resourceGroupName, storageSyncServiceName, body, options, (err, result, request, response) => { + self._create(resourceGroupName, storageSyncServiceName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1032,7 +1032,7 @@ class StorageSyncServices { * @param {string} storageSyncServiceName Name of Storage Sync Service * resource. * - * @param {object} body Storage Sync Service resource name. + * @param {object} parameters Storage Sync Service resource name. * * @param {object} [options] Optional Parameters. * @@ -1061,7 +1061,7 @@ class StorageSyncServices { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - create(resourceGroupName, storageSyncServiceName, body, options, optionalCallback) { + create(resourceGroupName, storageSyncServiceName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -1070,14 +1070,14 @@ class StorageSyncServices { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._create(resourceGroupName, storageSyncServiceName, body, options, (err, result, request, response) => { + self._create(resourceGroupName, storageSyncServiceName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._create(resourceGroupName, storageSyncServiceName, body, options, optionalCallback); + return self._create(resourceGroupName, storageSyncServiceName, parameters, options, optionalCallback); } } @@ -1182,7 +1182,7 @@ class StorageSyncServices { * * @param {object} [options] Optional Parameters. * - * @param {object} [options.body] Storage Sync Service resource. + * @param {object} [options.parameters] Storage Sync Service resource. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -1218,7 +1218,7 @@ class StorageSyncServices { * * @param {object} [options] Optional Parameters. * - * @param {object} [options.body] Storage Sync Service resource. + * @param {object} [options.parameters] Storage Sync Service resource. * * @param {object} [options.customHeaders] Headers that will be added to the * request diff --git a/lib/services/storagesyncManagement/lib/operations/syncGroups.js b/lib/services/storagesyncManagement/lib/operations/syncGroups.js index 9a3b76c9cd..5403647273 100644 --- a/lib/services/storagesyncManagement/lib/operations/syncGroups.js +++ b/lib/services/storagesyncManagement/lib/operations/syncGroups.js @@ -187,9 +187,9 @@ function _listByStorageSyncService(resourceGroupName, storageSyncServiceName, op * * @param {string} syncGroupName Name of Sync Group resource. * - * @param {object} body Sync Group Body + * @param {object} parameters Sync Group Body * - * @param {string} [body.uniqueId] Unique Id + * @param {string} [parameters.uniqueId] Unique Id * * @param {object} [options] Optional Parameters. * @@ -209,7 +209,7 @@ function _listByStorageSyncService(resourceGroupName, storageSyncServiceName, op * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _create(resourceGroupName, storageSyncServiceName, syncGroupName, body, options, callback) { +function _create(resourceGroupName, storageSyncServiceName, syncGroupName, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -250,8 +250,8 @@ function _create(resourceGroupName, storageSyncServiceName, syncGroupName, body, if (syncGroupName === null || syncGroupName === undefined || typeof syncGroupName.valueOf() !== 'string') { throw new Error('syncGroupName cannot be null or undefined and it must be of type string.'); } - if (body === null || body === undefined) { - throw new Error('body cannot be null or undefined.'); + 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.'); @@ -297,14 +297,14 @@ function _create(resourceGroupName, storageSyncServiceName, syncGroupName, body, let requestContent = null; let requestModel = null; try { - if (body !== null && body !== undefined) { + if (parameters !== null && parameters !== undefined) { let requestModelMapper = new client.models['SyncGroup']().mapper(); - requestModel = client.serialize(requestModelMapper, body, 'body'); + 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(body, null, 2)}.`); + `payload - ${JSON.stringify(parameters, null, 2)}.`); return callback(serializationError); } httpRequest.body = requestContent; @@ -798,9 +798,9 @@ class SyncGroups { * * @param {string} syncGroupName Name of Sync Group resource. * - * @param {object} body Sync Group Body + * @param {object} parameters Sync Group Body * - * @param {string} [body.uniqueId] Unique Id + * @param {string} [parameters.uniqueId] Unique Id * * @param {object} [options] Optional Parameters. * @@ -813,11 +813,11 @@ class SyncGroups { * * @reject {Error} - The error object. */ - createWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, body, options) { + createWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._create(resourceGroupName, storageSyncServiceName, syncGroupName, body, options, (err, result, request, response) => { + self._create(resourceGroupName, storageSyncServiceName, syncGroupName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -838,9 +838,9 @@ class SyncGroups { * * @param {string} syncGroupName Name of Sync Group resource. * - * @param {object} body Sync Group Body + * @param {object} parameters Sync Group Body * - * @param {string} [body.uniqueId] Unique Id + * @param {string} [parameters.uniqueId] Unique Id * * @param {object} [options] Optional Parameters. * @@ -869,7 +869,7 @@ class SyncGroups { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - create(resourceGroupName, storageSyncServiceName, syncGroupName, body, options, optionalCallback) { + create(resourceGroupName, storageSyncServiceName, syncGroupName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -878,14 +878,14 @@ class SyncGroups { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._create(resourceGroupName, storageSyncServiceName, syncGroupName, body, options, (err, result, request, response) => { + self._create(resourceGroupName, storageSyncServiceName, syncGroupName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._create(resourceGroupName, storageSyncServiceName, syncGroupName, body, options, optionalCallback); + return self._create(resourceGroupName, storageSyncServiceName, syncGroupName, parameters, options, optionalCallback); } }