From 3df2f7c47d7399d541f63ad05c6fdcdd801731a4 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 12 Jun 2018 21:30:12 -0700 Subject: [PATCH 1/5] [AutoPR storagesync/resource-manager] Storage Sync Swagger preview version (prev PR #109 (#2976) * Generated from bdcb59fb848aad33d655434511e28992a9186eec Added NodeJS + Java code gen config * Generated from 3c0da5ba17ebd8d58d92118f5cd2137e7137f2bf extra comma extra comma in pauseWaitForSyncDrainTimePeriodInSeconds * Generated from dd8124f88a1bebfa7dbca3e881781b3c5ef82028 body to parameters body to parameters --- .../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 | 129 + .../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 | 61 + .../lib/models/serverEndpoint.js | 216 + .../lib/models/serverEndpointArray.js | 59 + .../lib/models/storageSyncError.js | 74 + .../lib/models/storageSyncErrorDetails.js | 68 + .../lib/models/storageSyncService.js | 66 + .../lib/models/storageSyncServiceArray.js | 59 + .../lib/models/subscriptionState.js | 70 + .../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 | 3974 +++++++++++++++++ .../lib/operations/cloudEndpointsGet.js | 292 ++ .../lib/operations/getSyncGroups.js | 282 ++ .../lib/operations/index.d.ts | 3961 ++++++++++++++++ .../lib/operations/index.js | 23 + .../lib/operations/operationGet.js | 455 ++ .../lib/operations/operations.js | 455 ++ .../lib/operations/registeredServers.js | 1581 +++++++ .../lib/operations/registeredServersGet.js | 282 ++ .../lib/operations/serverEndpointRecall.js | 450 ++ .../lib/operations/serverEndpoints.js | 2981 +++++++++++++ .../lib/operations/serverEndpointsGet.js | 292 ++ .../storageSyncServiceByResourceGroupGet.js | 271 ++ .../lib/operations/storageSyncServiceGet.js | 244 + .../lib/operations/storageSyncServices.js | 1523 +++++++ .../lib/operations/syncGroups.js | 1081 +++++ .../lib/operations/workflows.js | 536 +++ .../lib/storageSyncManagementClient.d.ts | 68 + .../lib/storageSyncManagementClient.js | 91 + .../storagesyncManagement/package.json | 25 + 61 files changed, 24832 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/storageSyncError.js create mode 100644 lib/services/storagesyncManagement/lib/models/storageSyncErrorDetails.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/operations.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/lib/storageSyncManagementClient.d.ts create mode 100644 lib/services/storagesyncManagement/lib/storageSyncManagementClient.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..266b0589d5 --- /dev/null +++ b/lib/services/storagesyncManagement/README.md @@ -0,0 +1,40 @@ +--- +uid: azure-arm-storagesync +summary: *content + +--- +# 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** + +## Features + + +## How to Install + +```bash +npm install azure-arm-storagesync +``` + +## How to use + +### Authentication, client creation and list operations as an example. + +```javascript +const msRestAzure = require("ms-rest-azure"); +const StorageSyncManagementClient = require("azure-arm-storagesync"); +msRestAzure.interactiveLogin().then((creds) => { + const subscriptionId = ""; + const client = new StorageSyncManagementClient(creds, subscriptionId); + return client.operations.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..c4a7a1a1d5 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/cloudEndpoint.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'); + +/** + * 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, + readOnly: true, + 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..e263c38525 --- /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 StorageSyncErrorDetails 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 StorageSyncErrorDetails { + code?: string; + message?: string; + target?: string; +} + +/** + * @class + * Initializes a new instance of the StorageSyncError 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 StorageSyncError { + code?: string; + message?: string; + details?: StorageSyncErrorDetails; +} + +/** + * @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; + readonly 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; + readonly 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; + readonly 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..6c83dfd4ac --- /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.StorageSyncErrorDetails = require('./storageSyncErrorDetails'); +exports.StorageSyncError = require('./storageSyncError'); +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..3afda3c8b9 --- /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..1f6eb235f7 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/restoreFileSpec.js @@ -0,0 +1,61 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * 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, + readOnly: true, + 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/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/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..cf77bf1f05 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/subscriptionState.js @@ -0,0 +1,70 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * 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, + readOnly: true, + 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..99dc355613 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/cloudEndpoints.js @@ -0,0 +1,3974 @@ +/* + * 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} parameters Body of Cloud Endpoint resource. + * + * @param {string} [parameters.storageAccountKey] Storage Account access key. + * + * @param {string} [parameters.storageAccount] Storage Account name. + * + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id + * + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name + * + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id + * + * @param {string} [parameters.partnershipId] Partnership Id + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State + * + * @param {string} [parameters.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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['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['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 _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); + }); + }); +} + +/** + * 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['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['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); + }); +} + + +/** + * 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} parameters Body of Backup request. + * + * @param {string} [parameters.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 _preBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginPreBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * 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} parameters Body of Backup request. + * + * @param {string} [parameters.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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginPostBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Pre Restore partition. + * + * @param {string} [parameters.replicaGroup] Pre Restore replica group. + * + * @param {string} [parameters.requestId] Pre Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Pre Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. + * + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. + * + * @param {number} [parameters.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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginPreRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Post Restore partition. + * + * @param {string} [parameters.replicaGroup] Post Restore replica group. + * + * @param {string} [parameters.requestId] Post Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Post Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. + * + * @param {array} [parameters.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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginPostRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * 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} parameters Body of Cloud Endpoint resource. + * + * @param {string} [parameters.storageAccountKey] Storage Account access key. + * + * @param {string} [parameters.storageAccount] Storage Account name. + * + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id + * + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name + * + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id + * + * @param {string} [parameters.partnershipId] Partnership Id + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State + * + * @param {string} [parameters.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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['CloudEndpoint']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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} parameters Body of Backup request. + * + * @param {string} [parameters.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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['BackupRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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} parameters Body of Backup request. + * + * @param {string} [parameters.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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['BackupRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Pre Restore partition. + * + * @param {string} [parameters.replicaGroup] Pre Restore replica group. + * + * @param {string} [parameters.requestId] Pre Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Pre Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. + * + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. + * + * @param {number} [parameters.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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['PreRestoreRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Post Restore partition. + * + * @param {string} [parameters.replicaGroup] Post Restore replica group. + * + * @param {string} [parameters.requestId] Post Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Post Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. + * + * @param {array} [parameters.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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['PostRestoreRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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} parameters Body of Cloud Endpoint resource. + * + * @param {string} [parameters.storageAccountKey] Storage Account access key. + * + * @param {string} [parameters.storageAccount] Storage Account name. + * + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id + * + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name + * + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id + * + * @param {string} [parameters.partnershipId] Partnership Id + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State + * + * @param {string} [parameters.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, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + 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); } + 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} parameters Body of Cloud Endpoint resource. + * + * @param {string} [parameters.storageAccountKey] Storage Account access key. + * + * @param {string} [parameters.storageAccount] Storage Account name. + * + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id + * + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name + * + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id + * + * @param {string} [parameters.partnershipId] Partnership Id + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State + * + * @param {string} [parameters.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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._create(resourceGroupName, 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, parameters, 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} parameters Body of Backup request. + * + * @param {string} [parameters.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, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + 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); } + 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} parameters Body of Backup request. + * + * @param {string} [parameters.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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._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, parameters, 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} parameters Body of Backup request. + * + * @param {string} [parameters.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, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + 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); } + 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} parameters Body of Backup request. + * + * @param {string} [parameters.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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._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, parameters, 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Pre Restore partition. + * + * @param {string} [parameters.replicaGroup] Pre Restore replica group. + * + * @param {string} [parameters.requestId] Pre Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Pre Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. + * + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. + * + * @param {number} [parameters.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, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + 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); } + 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Pre Restore partition. + * + * @param {string} [parameters.replicaGroup] Pre Restore replica group. + * + * @param {string} [parameters.requestId] Pre Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Pre Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. + * + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. + * + * @param {number} [parameters.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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._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, parameters, 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Post Restore partition. + * + * @param {string} [parameters.replicaGroup] Post Restore replica group. + * + * @param {string} [parameters.requestId] Post Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Post Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. + * + * @param {array} [parameters.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, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + 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); } + 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Post Restore partition. + * + * @param {string} [parameters.replicaGroup] Post Restore replica group. + * + * @param {string} [parameters.requestId] Post Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Post Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. + * + * @param {array} [parameters.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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._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, parameters, 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} parameters Body of Cloud Endpoint resource. + * + * @param {string} [parameters.storageAccountKey] Storage Account access key. + * + * @param {string} [parameters.storageAccount] Storage Account name. + * + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id + * + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name + * + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id + * + * @param {string} [parameters.partnershipId] Partnership Id + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State + * + * @param {string} [parameters.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, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + 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); } + 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} parameters Body of Cloud Endpoint resource. + * + * @param {string} [parameters.storageAccountKey] Storage Account access key. + * + * @param {string} [parameters.storageAccount] Storage Account name. + * + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id + * + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name + * + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id + * + * @param {string} [parameters.partnershipId] Partnership Id + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State + * + * @param {string} [parameters.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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreate(resourceGroupName, 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, parameters, 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); + } + } + + /** + * 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} parameters Body of Backup request. + * + * @param {string} [parameters.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. + */ + 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, parameters, 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} parameters Body of Backup request. + * + * @param {string} [parameters.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. + */ + beginPreBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._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, parameters, 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} parameters Body of Backup request. + * + * @param {string} [parameters.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. + */ + 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, parameters, 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} parameters Body of Backup request. + * + * @param {string} [parameters.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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._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, parameters, 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Pre Restore partition. + * + * @param {string} [parameters.replicaGroup] Pre Restore replica group. + * + * @param {string} [parameters.requestId] Pre Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Pre Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. + * + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. + * + * @param {number} [parameters.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. + */ + 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, parameters, 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Pre Restore partition. + * + * @param {string} [parameters.replicaGroup] Pre Restore replica group. + * + * @param {string} [parameters.requestId] Pre Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Pre Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. + * + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. + * + * @param {number} [parameters.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. + */ + beginPreRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._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, parameters, 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Post Restore partition. + * + * @param {string} [parameters.replicaGroup] Post Restore replica group. + * + * @param {string} [parameters.requestId] Post Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Post Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. + * + * @param {array} [parameters.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. + */ + 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, parameters, 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Post Restore partition. + * + * @param {string} [parameters.replicaGroup] Post Restore replica group. + * + * @param {string} [parameters.requestId] Post Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Post Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. + * + * @param {array} [parameters.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. + */ + beginPostRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._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, parameters, 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..1bf2a332ab --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/index.d.ts @@ -0,0 +1,3961 @@ +/* + * 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 + * Operations + * __NOTE__: An instance of this class is automatically created for an + * instance of the StorageSyncManagementClient. + */ +export interface Operations { + + + /** + * 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 StorageSyncManagementClient. + */ +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} parameters 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, parameters: 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} parameters 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, 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; + + + /** + * 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.parameters] 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?: { parameters? : 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.parameters] 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?: { parameters? : models.StorageSyncService, customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, storageSyncServiceName: string, callback: ServiceCallback): void; + update(resourceGroupName: string, storageSyncServiceName: string, options: { parameters? : 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; + + + /** + * 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. + */ + listByResourceGroupWithHttpOperationResponse(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. + */ + 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; + + + /** + * 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 + * SyncGroups + * __NOTE__: An instance of this class is automatically created for an + * instance of the StorageSyncManagementClient. + */ +export interface SyncGroups { + + + /** + * 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; + + + /** + * 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} parameters Sync Group Body + * + * @param {string} [parameters.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, parameters: 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} parameters Sync Group Body + * + * @param {string} [parameters.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, 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; + + + /** + * 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 StorageSyncManagementClient. + */ +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} parameters Body of Cloud Endpoint resource. + * + * @param {string} [parameters.storageAccountKey] Storage Account access key. + * + * @param {string} [parameters.storageAccount] Storage Account name. + * + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id + * + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name + * + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id + * + * @param {string} [parameters.partnershipId] Partnership Id + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State + * + * @param {string} [parameters.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, parameters: 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} parameters Body of Cloud Endpoint resource. + * + * @param {string} [parameters.storageAccountKey] Storage Account access key. + * + * @param {string} [parameters.storageAccount] Storage Account name. + * + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id + * + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name + * + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id + * + * @param {string} [parameters.partnershipId] Partnership Id + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State + * + * @param {string} [parameters.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, 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; + + + /** + * 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; + + + /** + * 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; + + + /** + * 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} parameters Body of Backup request. + * + * @param {string} [parameters.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. + */ + preBackupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Backup request. + * + * @param {string} [parameters.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. + */ + 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; + + + /** + * 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} parameters Body of Backup request. + * + * @param {string} [parameters.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. + */ + postBackupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Backup request. + * + * @param {string} [parameters.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. + */ + 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; + + + /** + * 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Pre Restore partition. + * + * @param {string} [parameters.replicaGroup] Pre Restore replica group. + * + * @param {string} [parameters.requestId] Pre Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Pre Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. + * + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. + * + * @param {number} [parameters.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. + */ + preRestoreWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Pre Restore partition. + * + * @param {string} [parameters.replicaGroup] Pre Restore replica group. + * + * @param {string} [parameters.requestId] Pre Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Pre Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. + * + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. + * + * @param {number} [parameters.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. + */ + 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; + + + /** + * 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. + */ + restoreHeatbeatWithHttpOperationResponse(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. + */ + 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 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Post Restore partition. + * + * @param {string} [parameters.replicaGroup] Post Restore replica group. + * + * @param {string} [parameters.requestId] Post Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Post Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. + * + * @param {array} [parameters.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. + */ + postRestoreWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Post Restore partition. + * + * @param {string} [parameters.replicaGroup] Post Restore replica group. + * + * @param {string} [parameters.requestId] Post Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Post Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. + * + * @param {array} [parameters.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. + */ + 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; + + + /** + * 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} parameters Body of Cloud Endpoint resource. + * + * @param {string} [parameters.storageAccountKey] Storage Account access key. + * + * @param {string} [parameters.storageAccount] Storage Account name. + * + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id + * + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name + * + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id + * + * @param {string} [parameters.partnershipId] Partnership Id + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State + * + * @param {string} [parameters.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, parameters: 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} parameters Body of Cloud Endpoint resource. + * + * @param {string} [parameters.storageAccountKey] Storage Account access key. + * + * @param {string} [parameters.storageAccount] Storage Account name. + * + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id + * + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name + * + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id + * + * @param {string} [parameters.partnershipId] Partnership Id + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State + * + * @param {string} [parameters.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, 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; + + + /** + * 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; + + + /** + * 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} parameters Body of Backup request. + * + * @param {string} [parameters.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. + */ + beginPreBackupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Backup request. + * + * @param {string} [parameters.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. + */ + 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; + + + /** + * 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} parameters Body of Backup request. + * + * @param {string} [parameters.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. + */ + beginPostBackupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Backup request. + * + * @param {string} [parameters.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. + */ + 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; + + + /** + * 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Pre Restore partition. + * + * @param {string} [parameters.replicaGroup] Pre Restore replica group. + * + * @param {string} [parameters.requestId] Pre Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Pre Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. + * + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. + * + * @param {number} [parameters.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. + */ + beginPreRestoreWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Pre Restore partition. + * + * @param {string} [parameters.replicaGroup] Pre Restore replica group. + * + * @param {string} [parameters.requestId] Pre Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Pre Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. + * + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. + * + * @param {number} [parameters.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. + */ + 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; + + + /** + * 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Post Restore partition. + * + * @param {string} [parameters.replicaGroup] Post Restore replica group. + * + * @param {string} [parameters.requestId] Post Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Post Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. + * + * @param {array} [parameters.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. + */ + beginPostRestoreWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Post Restore partition. + * + * @param {string} [parameters.replicaGroup] Post Restore replica group. + * + * @param {string} [parameters.requestId] Post Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Post Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. + * + * @param {array} [parameters.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. + */ + 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; +} + +/** + * @class + * ServerEndpoints + * __NOTE__: An instance of this class is automatically created for an + * instance of the StorageSyncManagementClient. + */ +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} parameters Body of Server Endpoint object. + * + * @param {string} [parameters.serverLocalPath] Server Local path. + * + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {date} [parameters.lastSyncSuccess] Last Sync Success + * + * @param {string} [parameters.syncErrorState] Sync Error State + * + * @param {date} [parameters.syncErrorStateTimestamp] Sync Error State + * Timestamp + * + * @param {string} [parameters.syncErrorDirection] Sync Error Direction. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [parameters.itemUploadErrorCount] Item Upload Error Count. + * + * @param {number} [parameters.itemDownloadErrorCount] Item download error + * count. + * + * @param {string} [parameters.syncErrorContext] sync error context. + * + * @param {string} [parameters.currentProgressType] current progress type. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [parameters.itemProgressCount] Item Progress Count + * + * @param {number} [parameters.itemTotalCount] Item Total Count + * + * @param {number} [parameters.byteProgress] Bytes in progress + * + * @param {number} [parameters.totalProgress] Total progress + * + * @param {number} [parameters.byteTotal] Bytes total + * + * @param {string} [parameters.serverResourceId] Server Resource Id. + * + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [parameters.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, parameters: 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} parameters Body of Server Endpoint object. + * + * @param {string} [parameters.serverLocalPath] Server Local path. + * + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {date} [parameters.lastSyncSuccess] Last Sync Success + * + * @param {string} [parameters.syncErrorState] Sync Error State + * + * @param {date} [parameters.syncErrorStateTimestamp] Sync Error State + * Timestamp + * + * @param {string} [parameters.syncErrorDirection] Sync Error Direction. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [parameters.itemUploadErrorCount] Item Upload Error Count. + * + * @param {number} [parameters.itemDownloadErrorCount] Item download error + * count. + * + * @param {string} [parameters.syncErrorContext] sync error context. + * + * @param {string} [parameters.currentProgressType] current progress type. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [parameters.itemProgressCount] Item Progress Count + * + * @param {number} [parameters.itemTotalCount] Item Total Count + * + * @param {number} [parameters.byteProgress] Bytes in progress + * + * @param {number} [parameters.totalProgress] Total progress + * + * @param {number} [parameters.byteTotal] Bytes total + * + * @param {string} [parameters.serverResourceId] Server Resource Id. + * + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [parameters.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, 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; + + + /** + * 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.parameters] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.parameters.serverLocalPath] Server Local path. + * + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' + * + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.parameters.friendlyName] Friendly Name + * + * @param {date} [options.parameters.lastSyncSuccess] Last Sync Success + * + * @param {string} [options.parameters.syncErrorState] Sync Error State + * + * @param {date} [options.parameters.syncErrorStateTimestamp] Sync Error State + * Timestamp + * + * @param {string} [options.parameters.syncErrorDirection] Sync Error + * Direction. Possible values include: 'none', 'initialize', 'download', + * 'upload', 'recall' + * + * @param {number} [options.parameters.itemUploadErrorCount] Item Upload Error + * Count. + * + * @param {number} [options.parameters.itemDownloadErrorCount] Item download + * error count. + * + * @param {string} [options.parameters.syncErrorContext] sync error context. + * + * @param {string} [options.parameters.currentProgressType] current progress + * type. Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [options.parameters.itemProgressCount] Item Progress Count + * + * @param {number} [options.parameters.itemTotalCount] Item Total Count + * + * @param {number} [options.parameters.byteProgress] Bytes in progress + * + * @param {number} [options.parameters.totalProgress] Total progress + * + * @param {number} [options.parameters.byteTotal] Bytes total + * + * @param {string} [options.parameters.serverResourceId] Server Resource Id. + * + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State + * + * @param {string} [options.parameters.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?: { parameters? : 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.parameters] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.parameters.serverLocalPath] Server Local path. + * + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' + * + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.parameters.friendlyName] Friendly Name + * + * @param {date} [options.parameters.lastSyncSuccess] Last Sync Success + * + * @param {string} [options.parameters.syncErrorState] Sync Error State + * + * @param {date} [options.parameters.syncErrorStateTimestamp] Sync Error State + * Timestamp + * + * @param {string} [options.parameters.syncErrorDirection] Sync Error + * Direction. Possible values include: 'none', 'initialize', 'download', + * 'upload', 'recall' + * + * @param {number} [options.parameters.itemUploadErrorCount] Item Upload Error + * Count. + * + * @param {number} [options.parameters.itemDownloadErrorCount] Item download + * error count. + * + * @param {string} [options.parameters.syncErrorContext] sync error context. + * + * @param {string} [options.parameters.currentProgressType] current progress + * type. Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [options.parameters.itemProgressCount] Item Progress Count + * + * @param {number} [options.parameters.itemTotalCount] Item Total Count + * + * @param {number} [options.parameters.byteProgress] Bytes in progress + * + * @param {number} [options.parameters.totalProgress] Total progress + * + * @param {number} [options.parameters.byteTotal] Bytes total + * + * @param {string} [options.parameters.serverResourceId] Server Resource Id. + * + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State + * + * @param {string} [options.parameters.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?: { 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: { parameters? : 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; + + + /** + * 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; + + + /** + * 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. + */ + recallWithHttpOperationResponse(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. + */ + 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; + + + /** + * 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} parameters Body of Server Endpoint object. + * + * @param {string} [parameters.serverLocalPath] Server Local path. + * + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {date} [parameters.lastSyncSuccess] Last Sync Success + * + * @param {string} [parameters.syncErrorState] Sync Error State + * + * @param {date} [parameters.syncErrorStateTimestamp] Sync Error State + * Timestamp + * + * @param {string} [parameters.syncErrorDirection] Sync Error Direction. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [parameters.itemUploadErrorCount] Item Upload Error Count. + * + * @param {number} [parameters.itemDownloadErrorCount] Item download error + * count. + * + * @param {string} [parameters.syncErrorContext] sync error context. + * + * @param {string} [parameters.currentProgressType] current progress type. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [parameters.itemProgressCount] Item Progress Count + * + * @param {number} [parameters.itemTotalCount] Item Total Count + * + * @param {number} [parameters.byteProgress] Bytes in progress + * + * @param {number} [parameters.totalProgress] Total progress + * + * @param {number} [parameters.byteTotal] Bytes total + * + * @param {string} [parameters.serverResourceId] Server Resource Id. + * + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [parameters.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, parameters: 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} parameters Body of Server Endpoint object. + * + * @param {string} [parameters.serverLocalPath] Server Local path. + * + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {date} [parameters.lastSyncSuccess] Last Sync Success + * + * @param {string} [parameters.syncErrorState] Sync Error State + * + * @param {date} [parameters.syncErrorStateTimestamp] Sync Error State + * Timestamp + * + * @param {string} [parameters.syncErrorDirection] Sync Error Direction. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [parameters.itemUploadErrorCount] Item Upload Error Count. + * + * @param {number} [parameters.itemDownloadErrorCount] Item download error + * count. + * + * @param {string} [parameters.syncErrorContext] sync error context. + * + * @param {string} [parameters.currentProgressType] current progress type. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [parameters.itemProgressCount] Item Progress Count + * + * @param {number} [parameters.itemTotalCount] Item Total Count + * + * @param {number} [parameters.byteProgress] Bytes in progress + * + * @param {number} [parameters.totalProgress] Total progress + * + * @param {number} [parameters.byteTotal] Bytes total + * + * @param {string} [parameters.serverResourceId] Server Resource Id. + * + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [parameters.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, 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; + + + /** + * 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.parameters] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.parameters.serverLocalPath] Server Local path. + * + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' + * + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.parameters.friendlyName] Friendly Name + * + * @param {date} [options.parameters.lastSyncSuccess] Last Sync Success + * + * @param {string} [options.parameters.syncErrorState] Sync Error State + * + * @param {date} [options.parameters.syncErrorStateTimestamp] Sync Error State + * Timestamp + * + * @param {string} [options.parameters.syncErrorDirection] Sync Error + * Direction. Possible values include: 'none', 'initialize', 'download', + * 'upload', 'recall' + * + * @param {number} [options.parameters.itemUploadErrorCount] Item Upload Error + * Count. + * + * @param {number} [options.parameters.itemDownloadErrorCount] Item download + * error count. + * + * @param {string} [options.parameters.syncErrorContext] sync error context. + * + * @param {string} [options.parameters.currentProgressType] current progress + * type. Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [options.parameters.itemProgressCount] Item Progress Count + * + * @param {number} [options.parameters.itemTotalCount] Item Total Count + * + * @param {number} [options.parameters.byteProgress] Bytes in progress + * + * @param {number} [options.parameters.totalProgress] Total progress + * + * @param {number} [options.parameters.byteTotal] Bytes total + * + * @param {string} [options.parameters.serverResourceId] Server Resource Id. + * + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State + * + * @param {string} [options.parameters.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?: { parameters? : 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.parameters] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.parameters.serverLocalPath] Server Local path. + * + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' + * + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.parameters.friendlyName] Friendly Name + * + * @param {date} [options.parameters.lastSyncSuccess] Last Sync Success + * + * @param {string} [options.parameters.syncErrorState] Sync Error State + * + * @param {date} [options.parameters.syncErrorStateTimestamp] Sync Error State + * Timestamp + * + * @param {string} [options.parameters.syncErrorDirection] Sync Error + * Direction. Possible values include: 'none', 'initialize', 'download', + * 'upload', 'recall' + * + * @param {number} [options.parameters.itemUploadErrorCount] Item Upload Error + * Count. + * + * @param {number} [options.parameters.itemDownloadErrorCount] Item download + * error count. + * + * @param {string} [options.parameters.syncErrorContext] sync error context. + * + * @param {string} [options.parameters.currentProgressType] current progress + * type. Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [options.parameters.itemProgressCount] Item Progress Count + * + * @param {number} [options.parameters.itemTotalCount] Item Total Count + * + * @param {number} [options.parameters.byteProgress] Bytes in progress + * + * @param {number} [options.parameters.totalProgress] Total progress + * + * @param {number} [options.parameters.byteTotal] Bytes total + * + * @param {string} [options.parameters.serverResourceId] Server Resource Id. + * + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State + * + * @param {string} [options.parameters.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?: { 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: { parameters? : 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; + + + /** + * 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. + */ + beginRecallWithHttpOperationResponse(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. + */ + 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 + * RegisteredServers + * __NOTE__: An instance of this class is automatically created for an + * instance of the StorageSyncManagementClient. + */ +export interface RegisteredServers { + + + /** + * 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; + + + /** + * 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} parameters Body of Registered Server object. + * + * @param {string} [parameters.serverCertificate] Registered Server Certificate + * + * @param {string} [parameters.agentVersion] Registered Server Agent Version + * + * @param {string} [parameters.serverOSVersion] Registered Server OS Version + * + * @param {number} [parameters.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State + * + * @param {string} [parameters.serverRole] Registered Server serverRole + * + * @param {string} [parameters.clusterId] Registered Server clusterId + * + * @param {string} [parameters.clusterName] Registered Server clusterName + * + * @param {string} [parameters.serverId] Registered Server serverId + * + * @param {string} [parameters.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [parameters.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, parameters: 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} parameters Body of Registered Server object. + * + * @param {string} [parameters.serverCertificate] Registered Server Certificate + * + * @param {string} [parameters.agentVersion] Registered Server Agent Version + * + * @param {string} [parameters.serverOSVersion] Registered Server OS Version + * + * @param {number} [parameters.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State + * + * @param {string} [parameters.serverRole] Registered Server serverRole + * + * @param {string} [parameters.clusterId] Registered Server clusterId + * + * @param {string} [parameters.clusterName] Registered Server clusterName + * + * @param {string} [parameters.serverId] Registered Server serverId + * + * @param {string} [parameters.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [parameters.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, 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; + + + /** + * 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} parameters Body of Registered Server object. + * + * @param {string} [parameters.serverCertificate] Registered Server Certificate + * + * @param {string} [parameters.agentVersion] Registered Server Agent Version + * + * @param {string} [parameters.serverOSVersion] Registered Server OS Version + * + * @param {number} [parameters.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State + * + * @param {string} [parameters.serverRole] Registered Server serverRole + * + * @param {string} [parameters.clusterId] Registered Server clusterId + * + * @param {string} [parameters.clusterName] Registered Server clusterName + * + * @param {string} [parameters.serverId] Registered Server serverId + * + * @param {string} [parameters.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [parameters.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, parameters: 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} parameters Body of Registered Server object. + * + * @param {string} [parameters.serverCertificate] Registered Server Certificate + * + * @param {string} [parameters.agentVersion] Registered Server Agent Version + * + * @param {string} [parameters.serverOSVersion] Registered Server OS Version + * + * @param {number} [parameters.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State + * + * @param {string} [parameters.serverRole] Registered Server serverRole + * + * @param {string} [parameters.clusterId] Registered Server clusterId + * + * @param {string} [parameters.clusterName] Registered Server clusterName + * + * @param {string} [parameters.serverId] Registered Server serverId + * + * @param {string} [parameters.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [parameters.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, 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; + + + /** + * 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 StorageSyncManagementClient. + */ +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; + + + /** + * 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. + */ + abortWithHttpOperationResponse(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. + */ + 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 new file mode 100644 index 0000000000..9f76216fd2 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/index.js @@ -0,0 +1,23 @@ +/* + * 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.Operations = require('./operations'); +exports.StorageSyncServices = require('./storageSyncServices'); +exports.SyncGroups = require('./syncGroups'); +exports.CloudEndpoints = require('./cloudEndpoints'); +exports.ServerEndpoints = require('./serverEndpoints'); +exports.RegisteredServers = require('./registeredServers'); +exports.Workflows = require('./workflows'); 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/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 new file mode 100644 index 0000000000..9b73405de7 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/registeredServers.js @@ -0,0 +1,1581 @@ +/* + * 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['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. + * + * @param {string} resourceGroupName The name 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['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['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} parameters Body of Registered Server object. + * + * @param {string} [parameters.serverCertificate] Registered Server Certificate + * + * @param {string} [parameters.agentVersion] Registered Server Agent Version + * + * @param {string} [parameters.serverOSVersion] Registered Server OS Version + * + * @param {number} [parameters.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State + * + * @param {string} [parameters.serverRole] Registered Server serverRole + * + * @param {string} [parameters.clusterId] Registered Server clusterId + * + * @param {string} [parameters.clusterName] Registered Server clusterName + * + * @param {string} [parameters.serverId] Registered Server serverId + * + * @param {string} [parameters.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [parameters.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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreate(resourceGroupName, storageSyncServiceName, serverId, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['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} parameters Body of Registered Server object. + * + * @param {string} [parameters.serverCertificate] Registered Server Certificate + * + * @param {string} [parameters.agentVersion] Registered Server Agent Version + * + * @param {string} [parameters.serverOSVersion] Registered Server OS Version + * + * @param {number} [parameters.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State + * + * @param {string} [parameters.serverRole] Registered Server serverRole + * + * @param {string} [parameters.clusterId] Registered Server clusterId + * + * @param {string} [parameters.clusterName] Registered Server clusterName + * + * @param {string} [parameters.serverId] Registered Server serverId + * + * @param {string} [parameters.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [parameters.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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['RegisteredServer']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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['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['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 RegisteredServers. */ +class RegisteredServers { + /** + * Create a RegisteredServers. + * @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; + this._beginCreate = _beginCreate; + 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. + * + * @param {string} resourceGroupName The name 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} parameters Body of Registered Server object. + * + * @param {string} [parameters.serverCertificate] Registered Server Certificate + * + * @param {string} [parameters.agentVersion] Registered Server Agent Version + * + * @param {string} [parameters.serverOSVersion] Registered Server OS Version + * + * @param {number} [parameters.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State + * + * @param {string} [parameters.serverRole] Registered Server serverRole + * + * @param {string} [parameters.clusterId] Registered Server clusterId + * + * @param {string} [parameters.clusterName] Registered Server clusterName + * + * @param {string} [parameters.serverId] Registered Server serverId + * + * @param {string} [parameters.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [parameters.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, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + 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); } + 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} parameters Body of Registered Server object. + * + * @param {string} [parameters.serverCertificate] Registered Server Certificate + * + * @param {string} [parameters.agentVersion] Registered Server Agent Version + * + * @param {string} [parameters.serverOSVersion] Registered Server OS Version + * + * @param {number} [parameters.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State + * + * @param {string} [parameters.serverRole] Registered Server serverRole + * + * @param {string} [parameters.clusterId] Registered Server clusterId + * + * @param {string} [parameters.clusterName] Registered Server clusterName + * + * @param {string} [parameters.serverId] Registered Server serverId + * + * @param {string} [parameters.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [parameters.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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._create(resourceGroupName, storageSyncServiceName, serverId, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, storageSyncServiceName, serverId, parameters, 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} parameters Body of Registered Server object. + * + * @param {string} [parameters.serverCertificate] Registered Server Certificate + * + * @param {string} [parameters.agentVersion] Registered Server Agent Version + * + * @param {string} [parameters.serverOSVersion] Registered Server OS Version + * + * @param {number} [parameters.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State + * + * @param {string} [parameters.serverRole] Registered Server serverRole + * + * @param {string} [parameters.clusterId] Registered Server clusterId + * + * @param {string} [parameters.clusterName] Registered Server clusterName + * + * @param {string} [parameters.serverId] Registered Server serverId + * + * @param {string} [parameters.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [parameters.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, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + 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); } + 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} parameters Body of Registered Server object. + * + * @param {string} [parameters.serverCertificate] Registered Server Certificate + * + * @param {string} [parameters.agentVersion] Registered Server Agent Version + * + * @param {string} [parameters.serverOSVersion] Registered Server OS Version + * + * @param {number} [parameters.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State + * + * @param {string} [parameters.serverRole] Registered Server serverRole + * + * @param {string} [parameters.clusterId] Registered Server clusterId + * + * @param {string} [parameters.clusterName] Registered Server clusterName + * + * @param {string} [parameters.serverId] Registered Server serverId + * + * @param {string} [parameters.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [parameters.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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreate(resourceGroupName, storageSyncServiceName, serverId, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreate(resourceGroupName, storageSyncServiceName, serverId, parameters, 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..1798ad59c2 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/serverEndpoints.js @@ -0,0 +1,2981 @@ +/* + * 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} parameters Body of Server Endpoint object. + * + * @param {string} [parameters.serverLocalPath] Server Local path. + * + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {date} [parameters.lastSyncSuccess] Last Sync Success + * + * @param {string} [parameters.syncErrorState] Sync Error State + * + * @param {date} [parameters.syncErrorStateTimestamp] Sync Error State + * Timestamp + * + * @param {string} [parameters.syncErrorDirection] Sync Error Direction. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [parameters.itemUploadErrorCount] Item Upload Error Count. + * + * @param {number} [parameters.itemDownloadErrorCount] Item download error + * count. + * + * @param {string} [parameters.syncErrorContext] sync error context. + * + * @param {string} [parameters.currentProgressType] current progress type. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [parameters.itemProgressCount] Item Progress Count + * + * @param {number} [parameters.itemTotalCount] Item Total Count + * + * @param {number} [parameters.byteProgress] Bytes in progress + * + * @param {number} [parameters.totalProgress] Total progress + * + * @param {number} [parameters.byteTotal] Bytes total + * + * @param {string} [parameters.serverResourceId] Server Resource Id. + * + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [parameters.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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['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.parameters] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.parameters.serverLocalPath] Server Local path. + * + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' + * + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.parameters.friendlyName] Friendly Name + * + * @param {date} [options.parameters.lastSyncSuccess] Last Sync Success + * + * @param {string} [options.parameters.syncErrorState] Sync Error State + * + * @param {date} [options.parameters.syncErrorStateTimestamp] Sync Error State + * Timestamp + * + * @param {string} [options.parameters.syncErrorDirection] Sync Error + * Direction. Possible values include: 'none', 'initialize', 'download', + * 'upload', 'recall' + * + * @param {number} [options.parameters.itemUploadErrorCount] Item Upload Error + * Count. + * + * @param {number} [options.parameters.itemDownloadErrorCount] Item download + * error count. + * + * @param {string} [options.parameters.syncErrorContext] sync error context. + * + * @param {string} [options.parameters.currentProgressType] current progress + * type. Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [options.parameters.itemProgressCount] Item Progress Count + * + * @param {number} [options.parameters.itemTotalCount] Item Total Count + * + * @param {number} [options.parameters.byteProgress] Bytes in progress + * + * @param {number} [options.parameters.totalProgress] Total progress + * + * @param {number} [options.parameters.byteTotal] Bytes total + * + * @param {string} [options.parameters.serverResourceId] Server Resource Id. + * + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State + * + * @param {string} [options.parameters.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['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['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); + }); + }); +} + +/** + * 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. + * + * @param {string} resourceGroupName The name 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} parameters Body of Server Endpoint object. + * + * @param {string} [parameters.serverLocalPath] Server Local path. + * + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {date} [parameters.lastSyncSuccess] Last Sync Success + * + * @param {string} [parameters.syncErrorState] Sync Error State + * + * @param {date} [parameters.syncErrorStateTimestamp] Sync Error State + * Timestamp + * + * @param {string} [parameters.syncErrorDirection] Sync Error Direction. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [parameters.itemUploadErrorCount] Item Upload Error Count. + * + * @param {number} [parameters.itemDownloadErrorCount] Item download error + * count. + * + * @param {string} [parameters.syncErrorContext] sync error context. + * + * @param {string} [parameters.currentProgressType] current progress type. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [parameters.itemProgressCount] Item Progress Count + * + * @param {number} [parameters.itemTotalCount] Item Total Count + * + * @param {number} [parameters.byteProgress] Bytes in progress + * + * @param {number} [parameters.totalProgress] Total progress + * + * @param {number} [parameters.byteTotal] Bytes total + * + * @param {string} [parameters.serverResourceId] Server Resource Id. + * + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [parameters.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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ServerEndpoint']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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['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.parameters] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.parameters.serverLocalPath] Server Local path. + * + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' + * + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.parameters.friendlyName] Friendly Name + * + * @param {date} [options.parameters.lastSyncSuccess] Last Sync Success + * + * @param {string} [options.parameters.syncErrorState] Sync Error State + * + * @param {date} [options.parameters.syncErrorStateTimestamp] Sync Error State + * Timestamp + * + * @param {string} [options.parameters.syncErrorDirection] Sync Error + * Direction. Possible values include: 'none', 'initialize', 'download', + * 'upload', 'recall' + * + * @param {number} [options.parameters.itemUploadErrorCount] Item Upload Error + * Count. + * + * @param {number} [options.parameters.itemDownloadErrorCount] Item download + * error count. + * + * @param {string} [options.parameters.syncErrorContext] sync error context. + * + * @param {string} [options.parameters.currentProgressType] current progress + * type. Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [options.parameters.itemProgressCount] Item Progress Count + * + * @param {number} [options.parameters.itemTotalCount] Item Total Count + * + * @param {number} [options.parameters.byteProgress] Bytes in progress + * + * @param {number} [options.parameters.totalProgress] Total progress + * + * @param {number} [options.parameters.byteTotal] Bytes total + * + * @param {string} [options.parameters.serverResourceId] Server Resource Id. + * + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State + * + * @param {string} [options.parameters.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 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') { + 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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ServerEndpoint']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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['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['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); + }); +} + +/** + * 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} parameters Body of Server Endpoint object. + * + * @param {string} [parameters.serverLocalPath] Server Local path. + * + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {date} [parameters.lastSyncSuccess] Last Sync Success + * + * @param {string} [parameters.syncErrorState] Sync Error State + * + * @param {date} [parameters.syncErrorStateTimestamp] Sync Error State + * Timestamp + * + * @param {string} [parameters.syncErrorDirection] Sync Error Direction. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [parameters.itemUploadErrorCount] Item Upload Error Count. + * + * @param {number} [parameters.itemDownloadErrorCount] Item download error + * count. + * + * @param {string} [parameters.syncErrorContext] sync error context. + * + * @param {string} [parameters.currentProgressType] current progress type. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [parameters.itemProgressCount] Item Progress Count + * + * @param {number} [parameters.itemTotalCount] Item Total Count + * + * @param {number} [parameters.byteProgress] Bytes in progress + * + * @param {number} [parameters.totalProgress] Total progress + * + * @param {number} [parameters.byteTotal] Bytes total + * + * @param {string} [parameters.serverResourceId] Server Resource Id. + * + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [parameters.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, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + 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); } + 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} parameters Body of Server Endpoint object. + * + * @param {string} [parameters.serverLocalPath] Server Local path. + * + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {date} [parameters.lastSyncSuccess] Last Sync Success + * + * @param {string} [parameters.syncErrorState] Sync Error State + * + * @param {date} [parameters.syncErrorStateTimestamp] Sync Error State + * Timestamp + * + * @param {string} [parameters.syncErrorDirection] Sync Error Direction. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [parameters.itemUploadErrorCount] Item Upload Error Count. + * + * @param {number} [parameters.itemDownloadErrorCount] Item download error + * count. + * + * @param {string} [parameters.syncErrorContext] sync error context. + * + * @param {string} [parameters.currentProgressType] current progress type. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [parameters.itemProgressCount] Item Progress Count + * + * @param {number} [parameters.itemTotalCount] Item Total Count + * + * @param {number} [parameters.byteProgress] Bytes in progress + * + * @param {number} [parameters.totalProgress] Total progress + * + * @param {number} [parameters.byteTotal] Bytes total + * + * @param {string} [parameters.serverResourceId] Server Resource Id. + * + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [parameters.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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._create(resourceGroupName, 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, parameters, 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.parameters] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.parameters.serverLocalPath] Server Local path. + * + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' + * + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.parameters.friendlyName] Friendly Name + * + * @param {date} [options.parameters.lastSyncSuccess] Last Sync Success + * + * @param {string} [options.parameters.syncErrorState] Sync Error State + * + * @param {date} [options.parameters.syncErrorStateTimestamp] Sync Error State + * Timestamp + * + * @param {string} [options.parameters.syncErrorDirection] Sync Error + * Direction. Possible values include: 'none', 'initialize', 'download', + * 'upload', 'recall' + * + * @param {number} [options.parameters.itemUploadErrorCount] Item Upload Error + * Count. + * + * @param {number} [options.parameters.itemDownloadErrorCount] Item download + * error count. + * + * @param {string} [options.parameters.syncErrorContext] sync error context. + * + * @param {string} [options.parameters.currentProgressType] current progress + * type. Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [options.parameters.itemProgressCount] Item Progress Count + * + * @param {number} [options.parameters.itemTotalCount] Item Total Count + * + * @param {number} [options.parameters.byteProgress] Bytes in progress + * + * @param {number} [options.parameters.totalProgress] Total progress + * + * @param {number} [options.parameters.byteTotal] Bytes total + * + * @param {string} [options.parameters.serverResourceId] Server Resource Id. + * + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State + * + * @param {string} [options.parameters.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.parameters] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.parameters.serverLocalPath] Server Local path. + * + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' + * + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.parameters.friendlyName] Friendly Name + * + * @param {date} [options.parameters.lastSyncSuccess] Last Sync Success + * + * @param {string} [options.parameters.syncErrorState] Sync Error State + * + * @param {date} [options.parameters.syncErrorStateTimestamp] Sync Error State + * Timestamp + * + * @param {string} [options.parameters.syncErrorDirection] Sync Error + * Direction. Possible values include: 'none', 'initialize', 'download', + * 'upload', 'recall' + * + * @param {number} [options.parameters.itemUploadErrorCount] Item Upload Error + * Count. + * + * @param {number} [options.parameters.itemDownloadErrorCount] Item download + * error count. + * + * @param {string} [options.parameters.syncErrorContext] sync error context. + * + * @param {string} [options.parameters.currentProgressType] current progress + * type. Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [options.parameters.itemProgressCount] Item Progress Count + * + * @param {number} [options.parameters.itemTotalCount] Item Total Count + * + * @param {number} [options.parameters.byteProgress] Bytes in progress + * + * @param {number} [options.parameters.totalProgress] Total progress + * + * @param {number} [options.parameters.byteTotal] Bytes total + * + * @param {string} [options.parameters.serverResourceId] Server Resource Id. + * + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State + * + * @param {string} [options.parameters.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); + } + } + + /** + * 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); + } + } + + /** + * 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. + */ + recallWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + 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); } + 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. + */ + recall(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._recall(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._recall(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} parameters Body of Server Endpoint object. + * + * @param {string} [parameters.serverLocalPath] Server Local path. + * + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {date} [parameters.lastSyncSuccess] Last Sync Success + * + * @param {string} [parameters.syncErrorState] Sync Error State + * + * @param {date} [parameters.syncErrorStateTimestamp] Sync Error State + * Timestamp + * + * @param {string} [parameters.syncErrorDirection] Sync Error Direction. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [parameters.itemUploadErrorCount] Item Upload Error Count. + * + * @param {number} [parameters.itemDownloadErrorCount] Item download error + * count. + * + * @param {string} [parameters.syncErrorContext] sync error context. + * + * @param {string} [parameters.currentProgressType] current progress type. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [parameters.itemProgressCount] Item Progress Count + * + * @param {number} [parameters.itemTotalCount] Item Total Count + * + * @param {number} [parameters.byteProgress] Bytes in progress + * + * @param {number} [parameters.totalProgress] Total progress + * + * @param {number} [parameters.byteTotal] Bytes total + * + * @param {string} [parameters.serverResourceId] Server Resource Id. + * + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [parameters.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, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + 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); } + 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} parameters Body of Server Endpoint object. + * + * @param {string} [parameters.serverLocalPath] Server Local path. + * + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {date} [parameters.lastSyncSuccess] Last Sync Success + * + * @param {string} [parameters.syncErrorState] Sync Error State + * + * @param {date} [parameters.syncErrorStateTimestamp] Sync Error State + * Timestamp + * + * @param {string} [parameters.syncErrorDirection] Sync Error Direction. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [parameters.itemUploadErrorCount] Item Upload Error Count. + * + * @param {number} [parameters.itemDownloadErrorCount] Item download error + * count. + * + * @param {string} [parameters.syncErrorContext] sync error context. + * + * @param {string} [parameters.currentProgressType] current progress type. + * Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [parameters.itemProgressCount] Item Progress Count + * + * @param {number} [parameters.itemTotalCount] Item Total Count + * + * @param {number} [parameters.byteProgress] Bytes in progress + * + * @param {number} [parameters.totalProgress] Total progress + * + * @param {number} [parameters.byteTotal] Bytes total + * + * @param {string} [parameters.serverResourceId] Server Resource Id. + * + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [parameters.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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreate(resourceGroupName, 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, parameters, 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.parameters] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.parameters.serverLocalPath] Server Local path. + * + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' + * + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.parameters.friendlyName] Friendly Name + * + * @param {date} [options.parameters.lastSyncSuccess] Last Sync Success + * + * @param {string} [options.parameters.syncErrorState] Sync Error State + * + * @param {date} [options.parameters.syncErrorStateTimestamp] Sync Error State + * Timestamp + * + * @param {string} [options.parameters.syncErrorDirection] Sync Error + * Direction. Possible values include: 'none', 'initialize', 'download', + * 'upload', 'recall' + * + * @param {number} [options.parameters.itemUploadErrorCount] Item Upload Error + * Count. + * + * @param {number} [options.parameters.itemDownloadErrorCount] Item download + * error count. + * + * @param {string} [options.parameters.syncErrorContext] sync error context. + * + * @param {string} [options.parameters.currentProgressType] current progress + * type. Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [options.parameters.itemProgressCount] Item Progress Count + * + * @param {number} [options.parameters.itemTotalCount] Item Total Count + * + * @param {number} [options.parameters.byteProgress] Bytes in progress + * + * @param {number} [options.parameters.totalProgress] Total progress + * + * @param {number} [options.parameters.byteTotal] Bytes total + * + * @param {string} [options.parameters.serverResourceId] Server Resource Id. + * + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State + * + * @param {string} [options.parameters.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.parameters] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.parameters.serverLocalPath] Server Local path. + * + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' + * + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.parameters.friendlyName] Friendly Name + * + * @param {date} [options.parameters.lastSyncSuccess] Last Sync Success + * + * @param {string} [options.parameters.syncErrorState] Sync Error State + * + * @param {date} [options.parameters.syncErrorStateTimestamp] Sync Error State + * Timestamp + * + * @param {string} [options.parameters.syncErrorDirection] Sync Error + * Direction. Possible values include: 'none', 'initialize', 'download', + * 'upload', 'recall' + * + * @param {number} [options.parameters.itemUploadErrorCount] Item Upload Error + * Count. + * + * @param {number} [options.parameters.itemDownloadErrorCount] Item download + * error count. + * + * @param {string} [options.parameters.syncErrorContext] sync error context. + * + * @param {string} [options.parameters.currentProgressType] current progress + * type. Possible values include: 'none', 'initialize', 'download', 'upload', + * 'recall' + * + * @param {number} [options.parameters.itemProgressCount] Item Progress Count + * + * @param {number} [options.parameters.itemTotalCount] Item Total Count + * + * @param {number} [options.parameters.byteProgress] Bytes in progress + * + * @param {number} [options.parameters.totalProgress] Total progress + * + * @param {number} [options.parameters.byteTotal] Bytes total + * + * @param {string} [options.parameters.serverResourceId] Server Resource Id. + * + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State + * + * @param {string} [options.parameters.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); + } + } + + /** + * 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/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..d1bbc819bb --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/storageSyncServices.js @@ -0,0 +1,1523 @@ +/* + * 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} parameters 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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['StorageSyncService']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + 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['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['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['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.parameters] 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 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') { + 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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['StorageSyncService']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + 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['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['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); + }); +} + +/** + * 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 {StorageSyncManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._create = _create; + this._get = _get; + this._update = _update; + this._deleteMethod = _deleteMethod; + this._listByResourceGroup = _listByResourceGroup; + this._listBySubscription = _listBySubscription; + } + + /** + * 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} parameters 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, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._create(resourceGroupName, storageSyncServiceName, parameters, 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} parameters 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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._create(resourceGroupName, storageSyncServiceName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, storageSyncServiceName, parameters, 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.parameters] 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.parameters] 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); + } + } + + /** + * 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 new file mode 100644 index 0000000000..5403647273 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/syncGroups.js @@ -0,0 +1,1081 @@ +/* + * 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['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. + * + * @param {string} resourceGroupName The name 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} parameters Sync Group Body + * + * @param {string} [parameters.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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['SyncGroup']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + 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['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['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['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['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 SyncGroups. */ +class SyncGroups { + /** + * Create a SyncGroups. + * @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. + * + * @param {string} resourceGroupName The name 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} parameters Sync Group Body + * + * @param {string} [parameters.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, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + 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); } + 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} parameters Sync Group Body + * + * @param {string} [parameters.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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._create(resourceGroupName, storageSyncServiceName, syncGroupName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, storageSyncServiceName, syncGroupName, parameters, 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..7786329153 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/workflows.js @@ -0,0 +1,536 @@ +/* + * 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['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['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); + }); +} + +/** + * 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 {StorageSyncManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._abort = _abort; + } + + /** + * 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); + } + } + + /** + * 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 new file mode 100644 index 0000000000..c158f40b5e --- /dev/null +++ b/lib/services/storagesyncManagement/package.json @@ -0,0 +1,25 @@ +{ + "name": "azure-arm-storagesync", + "author": "Microsoft Corporation", + "description": "StorageSyncManagementClient 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/storageSyncManagementClient.js", + "types": "./lib/storageSyncManagementClient.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 aefe7775d9540537fcf2c6d3e8646a45ca73ab18 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 18 Jun 2018 17:09:07 -0700 Subject: [PATCH 2/5] [AutoPR storagesync/resource-manager] Add new version 2018-04-02 for Microsoft.StorageSync Resource Provider (#3001) * Generated from 84c25bde14c0bd3975b3e2d4fe39e59c16b3d62d New Api version changes - 2018-04-02 New Api version changes 2018-04-02 * Generated from f19da1779f85df4450cbcdaf9b1029e99114fee4 Fix examples --- .../storagesyncmanagement/LICENSE.txt | 21 + lib/services/storagesyncmanagement/README.md | 40 + .../lib/models/backupRequest.js | 52 + .../models/checkNameAvailabilityParameters.js | 61 + .../lib/models/checkNameAvailabilityResult.js | 78 + .../lib/models/cloudEndpoint.js | 137 + .../lib/models/cloudEndpointArray.js | 59 + .../lib/models/index.d.ts | 544 +++ .../storagesyncmanagement/lib/models/index.js | 49 + .../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 | 221 + .../lib/models/registeredServerArray.js | 59 + .../lib/models/resource.js | 75 + .../lib/models/resourcesMoveInfo.js | 67 + .../lib/models/restoreFileSpec.js | 61 + .../lib/models/serverEndpoint.js | 126 + .../lib/models/serverEndpointArray.js | 59 + .../lib/models/storageSyncError.js | 74 + .../lib/models/storageSyncErrorDetails.js | 68 + .../lib/models/storageSyncService.js | 66 + .../lib/models/storageSyncServiceArray.js | 59 + .../lib/models/subscriptionState.js | 70 + .../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/cloudEndpoints.js | 3986 +++++++++++++++++ .../lib/operations/index.d.ts | 3863 ++++++++++++++++ .../lib/operations/index.js | 23 + .../lib/operations/operations.js | 455 ++ .../lib/operations/registeredServers.js | 1659 +++++++ .../lib/operations/serverEndpoints.js | 2645 +++++++++++ .../lib/operations/storageSyncServices.js | 1783 ++++++++ .../lib/operations/syncGroups.js | 1081 +++++ .../lib/operations/workflows.js | 536 +++ .../lib/storageSyncManagementClient.d.ts | 68 + .../lib/storageSyncManagementClient.js | 91 + .../storagesyncmanagement/package.json | 25 + 45 files changed, 19225 insertions(+) create mode 100644 lib/services/storagesyncmanagement/LICENSE.txt create mode 100644 lib/services/storagesyncmanagement/README.md create mode 100644 lib/services/storagesyncmanagement/lib/models/backupRequest.js create mode 100644 lib/services/storagesyncmanagement/lib/models/checkNameAvailabilityParameters.js create mode 100644 lib/services/storagesyncmanagement/lib/models/checkNameAvailabilityResult.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/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/storageSyncError.js create mode 100644 lib/services/storagesyncmanagement/lib/models/storageSyncErrorDetails.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/cloudEndpoints.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/operations.js create mode 100644 lib/services/storagesyncmanagement/lib/operations/registeredServers.js create mode 100644 lib/services/storagesyncmanagement/lib/operations/serverEndpoints.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/lib/storageSyncManagementClient.d.ts create mode 100644 lib/services/storagesyncmanagement/lib/storageSyncManagementClient.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..d48092678a --- /dev/null +++ b/lib/services/storagesyncmanagement/README.md @@ -0,0 +1,40 @@ +--- +uid: azure-arm-storagesyncmanagement +summary: *content + +--- +# 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** + +## Features + + +## How to Install + +```bash +npm install azure-arm-storagesyncmanagement +``` + +## How to use + +### Authentication, client creation and list operations as an example. + +```javascript +const msRestAzure = require("ms-rest-azure"); +const StorageSyncManagementClient = require("azure-arm-storagesyncmanagement"); +msRestAzure.interactiveLogin().then((creds) => { + const subscriptionId = ""; + const client = new StorageSyncManagementClient(creds, subscriptionId); + return client.operations.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/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/checkNameAvailabilityParameters.js b/lib/services/storagesyncmanagement/lib/models/checkNameAvailabilityParameters.js new file mode 100644 index 0000000000..cad69bf476 --- /dev/null +++ b/lib/services/storagesyncmanagement/lib/models/checkNameAvailabilityParameters.js @@ -0,0 +1,61 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Parameters for a check name availability request. + * + */ +class CheckNameAvailabilityParameters { + /** + * Create a CheckNameAvailabilityParameters. + * @member {string} name The name to check for availability + */ + constructor() { + } + + /** + * Defines the metadata of CheckNameAvailabilityParameters + * + * @returns {object} metadata of CheckNameAvailabilityParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'CheckNameAvailabilityParameters', + type: { + name: 'Composite', + className: 'CheckNameAvailabilityParameters', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: true, + isConstant: true, + serializedName: 'type', + defaultValue: 'Microsoft.StorageSync/storageSyncServices', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = CheckNameAvailabilityParameters; diff --git a/lib/services/storagesyncmanagement/lib/models/checkNameAvailabilityResult.js b/lib/services/storagesyncmanagement/lib/models/checkNameAvailabilityResult.js new file mode 100644 index 0000000000..d060e0e65d --- /dev/null +++ b/lib/services/storagesyncmanagement/lib/models/checkNameAvailabilityResult.js @@ -0,0 +1,78 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The CheckNameAvailability operation response. + * + */ +class CheckNameAvailabilityResult { + /** + * Create a CheckNameAvailabilityResult. + * @member {boolean} [nameAvailable] Gets a boolean value that indicates + * whether the name is available for you to use. If true, the name is + * available. If false, the name has already been taken or invalid and cannot + * be used. + * @member {string} [reason] Gets the reason that a Storage Sync Service name + * could not be used. The Reason element is only returned if NameAvailable is + * false. Possible values include: 'Invalid', 'AlreadyExists' + * @member {string} [message] Gets an error message explaining the Reason + * value in more detail. + */ + constructor() { + } + + /** + * Defines the metadata of CheckNameAvailabilityResult + * + * @returns {object} metadata of CheckNameAvailabilityResult + * + */ + mapper() { + return { + required: false, + serializedName: 'CheckNameAvailabilityResult', + type: { + name: 'Composite', + className: 'CheckNameAvailabilityResult', + modelProperties: { + nameAvailable: { + required: false, + readOnly: true, + serializedName: 'nameAvailable', + type: { + name: 'Boolean' + } + }, + reason: { + required: false, + readOnly: true, + serializedName: 'reason', + type: { + name: 'Enum', + allowedValues: [ 'Invalid', 'AlreadyExists' ] + } + }, + message: { + required: false, + readOnly: true, + serializedName: 'message', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = CheckNameAvailabilityResult; diff --git a/lib/services/storagesyncmanagement/lib/models/cloudEndpoint.js b/lib/services/storagesyncmanagement/lib/models/cloudEndpoint.js new file mode 100644 index 0000000000..8143070314 --- /dev/null +++ b/lib/services/storagesyncmanagement/lib/models/cloudEndpoint.js @@ -0,0 +1,137 @@ +/* + * 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 + * @member {string} [lastOperationName] Resource Last Operation Name + */ + 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, + readOnly: true, + serializedName: 'properties.backupEnabled', + type: { + name: 'Boolean' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + lastWorkflowId: { + required: false, + serializedName: 'properties.lastWorkflowId', + type: { + name: 'String' + } + }, + lastOperationName: { + required: false, + serializedName: 'properties.lastOperationName', + 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/index.d.ts b/lib/services/storagesyncmanagement/lib/models/index.d.ts new file mode 100644 index 0000000000..739d5206e3 --- /dev/null +++ b/lib/services/storagesyncmanagement/lib/models/index.d.ts @@ -0,0 +1,544 @@ +/* + * 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 StorageSyncErrorDetails 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 StorageSyncErrorDetails { + code?: string; + message?: string; + target?: string; +} + +/** + * @class + * Initializes a new instance of the StorageSyncError 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 StorageSyncError { + code?: string; + message?: string; + details?: StorageSyncErrorDetails; +} + +/** + * @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; + readonly 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 + * @member {string} [lastOperationName] Resource Last Operation Name + */ +export interface CloudEndpoint extends BaseResource { + storageAccountKey?: string; + storageAccount?: string; + storageAccountResourceId?: string; + storageAccountShareName?: string; + storageAccountTenantId?: string; + partnershipId?: string; + friendlyName?: string; + readonly backupEnabled?: boolean; + provisioningState?: string; + lastWorkflowId?: string; + lastOperationName?: 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 {string} [serverResourceId] Server Resource Id. + * @member {string} [provisioningState] ServerEndpoint Provisioning State + * @member {string} [lastWorkflowId] ServerEndpoint lastWorkflowId + * @member {string} [lastOperationName] Resource Last Operation Name + * @member {object} [syncStatus] Sync Health Status + */ +export interface ServerEndpoint extends BaseResource { + serverLocalPath?: string; + cloudTiering?: string; + volumeFreeSpacePercent?: number; + friendlyName?: string; + serverResourceId?: string; + provisioningState?: string; + lastWorkflowId?: string; + lastOperationName?: string; + syncStatus?: any; +} + +/** + * @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 + * @member {string} [lastOperationName] Resource Last Operation Name + * @member {string} [discoveryEndpointUri] Resource discoveryEndpointUri + * @member {string} [resourceLocation] Resource Location + * @member {string} [serviceLocation] Service Location + * @member {string} [friendlyName] Friendly Name + * @member {string} [managementEndpointUri] Management Endpoint Uri + */ +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; + lastOperationName?: string; + discoveryEndpointUri?: string; + resourceLocation?: string; + serviceLocation?: string; + friendlyName?: string; + managementEndpointUri?: 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 CheckNameAvailabilityParameters class. + * @constructor + * Parameters for a check name availability request. + * + * @member {string} name The name to check for availability + */ +export interface CheckNameAvailabilityParameters { + name: string; +} + +/** + * @class + * Initializes a new instance of the CheckNameAvailabilityResult class. + * @constructor + * The CheckNameAvailability operation response. + * + * @member {boolean} [nameAvailable] Gets a boolean value that indicates + * whether the name is available for you to use. If true, the name is + * available. If false, the name has already been taken or invalid and cannot + * be used. + * @member {string} [reason] Gets the reason that a Storage Sync Service name + * could not be used. The Reason element is only returned if NameAvailable is + * false. Possible values include: 'Invalid', 'AlreadyExists' + * @member {string} [message] Gets an error message explaining the Reason value + * in more detail. + */ +export interface CheckNameAvailabilityResult { + readonly nameAvailable?: boolean; + readonly reason?: string; + readonly message?: 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; + readonly 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..e4896fad4c --- /dev/null +++ b/lib/services/storagesyncmanagement/lib/models/index.js @@ -0,0 +1,49 @@ +/* + * 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.StorageSyncErrorDetails = require('./storageSyncErrorDetails'); +exports.StorageSyncError = require('./storageSyncError'); +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.CheckNameAvailabilityParameters = require('./checkNameAvailabilityParameters'); +exports.CheckNameAvailabilityResult = require('./checkNameAvailabilityResult'); +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..3afda3c8b9 --- /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..cfa338c603 --- /dev/null +++ b/lib/services/storagesyncmanagement/lib/models/registeredServer.js @@ -0,0 +1,221 @@ +/* + * 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 + * @member {string} [lastOperationName] Resource Last Operation Name + * @member {string} [discoveryEndpointUri] Resource discoveryEndpointUri + * @member {string} [resourceLocation] Resource Location + * @member {string} [serviceLocation] Service Location + * @member {string} [friendlyName] Friendly Name + * @member {string} [managementEndpointUri] Management Endpoint Uri + */ + 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' + } + }, + lastOperationName: { + required: false, + serializedName: 'properties.lastOperationName', + type: { + name: 'String' + } + }, + discoveryEndpointUri: { + required: false, + serializedName: 'properties.discoveryEndpointUri', + type: { + name: 'String' + } + }, + resourceLocation: { + required: false, + serializedName: 'properties.resourceLocation', + type: { + name: 'String' + } + }, + serviceLocation: { + required: false, + serializedName: 'properties.serviceLocation', + type: { + name: 'String' + } + }, + friendlyName: { + required: false, + serializedName: 'properties.friendlyName', + type: { + name: 'String' + } + }, + managementEndpointUri: { + required: false, + serializedName: 'properties.managementEndpointUri', + 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..1f6eb235f7 --- /dev/null +++ b/lib/services/storagesyncmanagement/lib/models/restoreFileSpec.js @@ -0,0 +1,61 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * 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, + readOnly: true, + 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..98554e6aa1 --- /dev/null +++ b/lib/services/storagesyncmanagement/lib/models/serverEndpoint.js @@ -0,0 +1,126 @@ +/* + * 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 {string} [serverResourceId] Server Resource Id. + * @member {string} [provisioningState] ServerEndpoint Provisioning State + * @member {string} [lastWorkflowId] ServerEndpoint lastWorkflowId + * @member {string} [lastOperationName] Resource Last Operation Name + * @member {object} [syncStatus] Sync Health Status + */ + 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' + } + }, + 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' + } + }, + lastOperationName: { + required: false, + serializedName: 'properties.lastOperationName', + type: { + name: 'String' + } + }, + syncStatus: { + required: false, + serializedName: 'properties.syncStatus', + type: { + name: 'Object' + } + } + } + } + }; + } +} + +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/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/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..cf77bf1f05 --- /dev/null +++ b/lib/services/storagesyncmanagement/lib/models/subscriptionState.js @@ -0,0 +1,70 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * 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, + readOnly: true, + 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/cloudEndpoints.js b/lib/services/storagesyncmanagement/lib/operations/cloudEndpoints.js new file mode 100644 index 0000000000..3227f0ef9f --- /dev/null +++ b/lib/services/storagesyncmanagement/lib/operations/cloudEndpoints.js @@ -0,0 +1,3986 @@ +/* + * 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} parameters Body of Cloud Endpoint resource. + * + * @param {string} [parameters.storageAccountKey] Storage Account access key. + * + * @param {string} [parameters.storageAccount] Storage Account name. + * + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id + * + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name + * + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id + * + * @param {string} [parameters.partnershipId] Partnership Id + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation 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 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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['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['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 _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); + }); + }); +} + +/** + * 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['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['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); + }); +} + + +/** + * 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} parameters Body of Backup request. + * + * @param {string} [parameters.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 _preBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginPreBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * 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} parameters Body of Backup request. + * + * @param {string} [parameters.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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginPostBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Pre Restore partition. + * + * @param {string} [parameters.replicaGroup] Pre Restore replica group. + * + * @param {string} [parameters.requestId] Pre Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Pre Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. + * + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. + * + * @param {number} [parameters.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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginPreRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * 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 _restoreheartbeat(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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Post Restore partition. + * + * @param {string} [parameters.replicaGroup] Post Restore replica group. + * + * @param {string} [parameters.requestId] Post Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Post Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. + * + * @param {array} [parameters.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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginPostRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * 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} parameters Body of Cloud Endpoint resource. + * + * @param {string} [parameters.storageAccountKey] Storage Account access key. + * + * @param {string} [parameters.storageAccount] Storage Account name. + * + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id + * + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name + * + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id + * + * @param {string} [parameters.partnershipId] Partnership Id + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation 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 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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['CloudEndpoint']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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} parameters Body of Backup request. + * + * @param {string} [parameters.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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['BackupRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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} parameters Body of Backup request. + * + * @param {string} [parameters.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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['BackupRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Pre Restore partition. + * + * @param {string} [parameters.replicaGroup] Pre Restore replica group. + * + * @param {string} [parameters.requestId] Pre Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Pre Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. + * + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. + * + * @param {number} [parameters.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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['PreRestoreRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Post Restore partition. + * + * @param {string} [parameters.replicaGroup] Post Restore replica group. + * + * @param {string} [parameters.requestId] Post Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Post Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. + * + * @param {array} [parameters.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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['PostRestoreRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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._restoreheartbeat = _restoreheartbeat; + 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} parameters Body of Cloud Endpoint resource. + * + * @param {string} [parameters.storageAccountKey] Storage Account access key. + * + * @param {string} [parameters.storageAccount] Storage Account name. + * + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id + * + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name + * + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id + * + * @param {string} [parameters.partnershipId] Partnership Id + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation 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, syncGroupName, cloudEndpointName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + 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); } + 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} parameters Body of Cloud Endpoint resource. + * + * @param {string} [parameters.storageAccountKey] Storage Account access key. + * + * @param {string} [parameters.storageAccount] Storage Account name. + * + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id + * + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name + * + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id + * + * @param {string} [parameters.partnershipId] Partnership Id + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation 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 {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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._create(resourceGroupName, 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, parameters, 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} parameters Body of Backup request. + * + * @param {string} [parameters.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, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + 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); } + 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} parameters Body of Backup request. + * + * @param {string} [parameters.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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._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, parameters, 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} parameters Body of Backup request. + * + * @param {string} [parameters.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, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + 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); } + 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} parameters Body of Backup request. + * + * @param {string} [parameters.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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._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, parameters, 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Pre Restore partition. + * + * @param {string} [parameters.replicaGroup] Pre Restore replica group. + * + * @param {string} [parameters.requestId] Pre Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Pre Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. + * + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. + * + * @param {number} [parameters.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, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + 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); } + 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Pre Restore partition. + * + * @param {string} [parameters.replicaGroup] Pre Restore replica group. + * + * @param {string} [parameters.requestId] Pre Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Pre Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. + * + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. + * + * @param {number} [parameters.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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._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, parameters, 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. + */ + restoreheartbeatWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._restoreheartbeat(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. + */ + restoreheartbeat(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._restoreheartbeat(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._restoreheartbeat(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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Post Restore partition. + * + * @param {string} [parameters.replicaGroup] Post Restore replica group. + * + * @param {string} [parameters.requestId] Post Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Post Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. + * + * @param {array} [parameters.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, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + 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); } + 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Post Restore partition. + * + * @param {string} [parameters.replicaGroup] Post Restore replica group. + * + * @param {string} [parameters.requestId] Post Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Post Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. + * + * @param {array} [parameters.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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._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, parameters, 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} parameters Body of Cloud Endpoint resource. + * + * @param {string} [parameters.storageAccountKey] Storage Account access key. + * + * @param {string} [parameters.storageAccount] Storage Account name. + * + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id + * + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name + * + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id + * + * @param {string} [parameters.partnershipId] Partnership Id + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation 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. + */ + 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, parameters, 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} parameters Body of Cloud Endpoint resource. + * + * @param {string} [parameters.storageAccountKey] Storage Account access key. + * + * @param {string} [parameters.storageAccount] Storage Account name. + * + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id + * + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name + * + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id + * + * @param {string} [parameters.partnershipId] Partnership Id + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation 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 {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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreate(resourceGroupName, 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, parameters, 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); + } + } + + /** + * 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} parameters Body of Backup request. + * + * @param {string} [parameters.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. + */ + 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, parameters, 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} parameters Body of Backup request. + * + * @param {string} [parameters.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. + */ + beginPreBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._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, parameters, 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} parameters Body of Backup request. + * + * @param {string} [parameters.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. + */ + 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, parameters, 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} parameters Body of Backup request. + * + * @param {string} [parameters.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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._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, parameters, 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Pre Restore partition. + * + * @param {string} [parameters.replicaGroup] Pre Restore replica group. + * + * @param {string} [parameters.requestId] Pre Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Pre Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. + * + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. + * + * @param {number} [parameters.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. + */ + 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, parameters, 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Pre Restore partition. + * + * @param {string} [parameters.replicaGroup] Pre Restore replica group. + * + * @param {string} [parameters.requestId] Pre Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Pre Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. + * + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. + * + * @param {number} [parameters.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. + */ + beginPreRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._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, parameters, 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Post Restore partition. + * + * @param {string} [parameters.replicaGroup] Post Restore replica group. + * + * @param {string} [parameters.requestId] Post Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Post Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. + * + * @param {array} [parameters.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. + */ + 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, parameters, 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Post Restore partition. + * + * @param {string} [parameters.replicaGroup] Post Restore replica group. + * + * @param {string} [parameters.requestId] Post Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Post Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. + * + * @param {array} [parameters.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. + */ + beginPostRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._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, parameters, options, optionalCallback); + } + } + +} + +module.exports = CloudEndpoints; 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..74d7e97dc0 --- /dev/null +++ b/lib/services/storagesyncmanagement/lib/operations/index.d.ts @@ -0,0 +1,3863 @@ +/* + * 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 + * Operations + * __NOTE__: An instance of this class is automatically created for an + * instance of the StorageSyncManagementClient. + */ +export interface Operations { + + + /** + * 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 StorageSyncManagementClient. + */ +export interface StorageSyncServices { + + + /** + * Check the give namespace name availability. + * + * @param {string} locationName The desired region for the name check. + * + * @param {object} parameters Parameters to check availability of the given + * namespace name + * + * @param {string} parameters.name The name to check for availability + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + checkNameAvailabilityWithHttpOperationResponse(locationName: string, parameters: models.CheckNameAvailabilityParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Check the give namespace name availability. + * + * @param {string} locationName The desired region for the name check. + * + * @param {object} parameters Parameters to check availability of the given + * namespace name + * + * @param {string} parameters.name The name to check for availability + * + * @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 {CheckNameAvailabilityResult} - 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. + * + * {CheckNameAvailabilityResult} [result] - The deserialized result object if an error did not occur. + * See {@link CheckNameAvailabilityResult} 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. + */ + checkNameAvailability(locationName: string, parameters: models.CheckNameAvailabilityParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + checkNameAvailability(locationName: string, parameters: models.CheckNameAvailabilityParameters, callback: ServiceCallback): void; + checkNameAvailability(locationName: string, parameters: models.CheckNameAvailabilityParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * 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} parameters 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, parameters: 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} parameters 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, 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; + + + /** + * 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.parameters] 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?: { parameters? : 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.parameters] 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?: { parameters? : models.StorageSyncService, customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, storageSyncServiceName: string, callback: ServiceCallback): void; + update(resourceGroupName: string, storageSyncServiceName: string, options: { parameters? : 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; + + + /** + * 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. + */ + listByResourceGroupWithHttpOperationResponse(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. + */ + 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; + + + /** + * 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 + * SyncGroups + * __NOTE__: An instance of this class is automatically created for an + * instance of the StorageSyncManagementClient. + */ +export interface SyncGroups { + + + /** + * 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; + + + /** + * 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} parameters Sync Group Body + * + * @param {string} [parameters.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, parameters: 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} parameters Sync Group Body + * + * @param {string} [parameters.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, 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; + + + /** + * 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 StorageSyncManagementClient. + */ +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} parameters Body of Cloud Endpoint resource. + * + * @param {string} [parameters.storageAccountKey] Storage Account access key. + * + * @param {string} [parameters.storageAccount] Storage Account name. + * + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id + * + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name + * + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id + * + * @param {string} [parameters.partnershipId] Partnership Id + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation 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, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Cloud Endpoint resource. + * + * @param {string} [parameters.storageAccountKey] Storage Account access key. + * + * @param {string} [parameters.storageAccount] Storage Account name. + * + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id + * + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name + * + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id + * + * @param {string} [parameters.partnershipId] Partnership Id + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation 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 {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, 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; + + + /** + * 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; + + + /** + * 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; + + + /** + * 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} parameters Body of Backup request. + * + * @param {string} [parameters.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. + */ + preBackupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Backup request. + * + * @param {string} [parameters.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. + */ + 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; + + + /** + * 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} parameters Body of Backup request. + * + * @param {string} [parameters.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. + */ + postBackupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Backup request. + * + * @param {string} [parameters.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. + */ + 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; + + + /** + * 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Pre Restore partition. + * + * @param {string} [parameters.replicaGroup] Pre Restore replica group. + * + * @param {string} [parameters.requestId] Pre Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Pre Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. + * + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. + * + * @param {number} [parameters.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. + */ + preRestoreWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Pre Restore partition. + * + * @param {string} [parameters.replicaGroup] Pre Restore replica group. + * + * @param {string} [parameters.requestId] Pre Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Pre Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. + * + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. + * + * @param {number} [parameters.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. + */ + 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; + + + /** + * 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. + */ + restoreheartbeatWithHttpOperationResponse(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. + */ + restoreheartbeat(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + restoreheartbeat(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, callback: ServiceCallback): void; + restoreheartbeat(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Post Restore partition. + * + * @param {string} [parameters.replicaGroup] Post Restore replica group. + * + * @param {string} [parameters.requestId] Post Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Post Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. + * + * @param {array} [parameters.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. + */ + postRestoreWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Post Restore partition. + * + * @param {string} [parameters.replicaGroup] Post Restore replica group. + * + * @param {string} [parameters.requestId] Post Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Post Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. + * + * @param {array} [parameters.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. + */ + 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; + + + /** + * 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} parameters Body of Cloud Endpoint resource. + * + * @param {string} [parameters.storageAccountKey] Storage Account access key. + * + * @param {string} [parameters.storageAccount] Storage Account name. + * + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id + * + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name + * + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id + * + * @param {string} [parameters.partnershipId] Partnership Id + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation 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. + */ + beginCreateWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Cloud Endpoint resource. + * + * @param {string} [parameters.storageAccountKey] Storage Account access key. + * + * @param {string} [parameters.storageAccount] Storage Account name. + * + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id + * + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name + * + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id + * + * @param {string} [parameters.partnershipId] Partnership Id + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation 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 {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, 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; + + + /** + * 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; + + + /** + * 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} parameters Body of Backup request. + * + * @param {string} [parameters.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. + */ + beginPreBackupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Backup request. + * + * @param {string} [parameters.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. + */ + 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; + + + /** + * 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} parameters Body of Backup request. + * + * @param {string} [parameters.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. + */ + beginPostBackupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Backup request. + * + * @param {string} [parameters.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. + */ + 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; + + + /** + * 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Pre Restore partition. + * + * @param {string} [parameters.replicaGroup] Pre Restore replica group. + * + * @param {string} [parameters.requestId] Pre Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Pre Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. + * + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. + * + * @param {number} [parameters.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. + */ + beginPreRestoreWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Pre Restore partition. + * + * @param {string} [parameters.replicaGroup] Pre Restore replica group. + * + * @param {string} [parameters.requestId] Pre Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Pre Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. + * + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. + * + * @param {number} [parameters.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. + */ + 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; + + + /** + * 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Post Restore partition. + * + * @param {string} [parameters.replicaGroup] Post Restore replica group. + * + * @param {string} [parameters.requestId] Post Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Post Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. + * + * @param {array} [parameters.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. + */ + beginPostRestoreWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Post Restore partition. + * + * @param {string} [parameters.replicaGroup] Post Restore replica group. + * + * @param {string} [parameters.requestId] Post Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Post Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. + * + * @param {array} [parameters.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. + */ + 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; +} + +/** + * @class + * ServerEndpoints + * __NOTE__: An instance of this class is automatically created for an + * instance of the StorageSyncManagementClient. + */ +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} parameters Body of Server Endpoint object. + * + * @param {string} [parameters.serverLocalPath] Server Local path. + * + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.serverResourceId] Server Resource Id. + * + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {object} [parameters.syncStatus] Sync Health Status + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, parameters: 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} parameters Body of Server Endpoint object. + * + * @param {string} [parameters.serverLocalPath] Server Local path. + * + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.serverResourceId] Server Resource Id. + * + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {object} [parameters.syncStatus] Sync Health Status + * + * @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, 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; + + + /** + * 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.parameters] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.parameters.serverLocalPath] Server Local path. + * + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' + * + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.parameters.friendlyName] Friendly Name + * + * @param {string} [options.parameters.serverResourceId] Server Resource Id. + * + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State + * + * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint + * lastWorkflowId + * + * @param {string} [options.parameters.lastOperationName] Resource Last + * Operation Name + * + * @param {object} [options.parameters.syncStatus] Sync Health Status + * + * @param {object} [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?: { parameters? : 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.parameters] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.parameters.serverLocalPath] Server Local path. + * + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' + * + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.parameters.friendlyName] Friendly Name + * + * @param {string} [options.parameters.serverResourceId] Server Resource Id. + * + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State + * + * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint + * lastWorkflowId + * + * @param {string} [options.parameters.lastOperationName] Resource Last + * Operation Name + * + * @param {object} [options.parameters.syncStatus] Sync Health Status + * + * @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?: { 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: { parameters? : 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; + + + /** + * 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; + + + /** + * 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. + */ + recallActionWithHttpOperationResponse(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. + */ + recallAction(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + recallAction(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, callback: ServiceCallback): void; + recallAction(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} parameters Body of Server Endpoint object. + * + * @param {string} [parameters.serverLocalPath] Server Local path. + * + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.serverResourceId] Server Resource Id. + * + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {object} [parameters.syncStatus] Sync Health Status + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, parameters: 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} parameters Body of Server Endpoint object. + * + * @param {string} [parameters.serverLocalPath] Server Local path. + * + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.serverResourceId] Server Resource Id. + * + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {object} [parameters.syncStatus] Sync Health Status + * + * @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, 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; + + + /** + * 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.parameters] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.parameters.serverLocalPath] Server Local path. + * + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' + * + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.parameters.friendlyName] Friendly Name + * + * @param {string} [options.parameters.serverResourceId] Server Resource Id. + * + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State + * + * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint + * lastWorkflowId + * + * @param {string} [options.parameters.lastOperationName] Resource Last + * Operation Name + * + * @param {object} [options.parameters.syncStatus] Sync Health Status + * + * @param {object} [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?: { parameters? : 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.parameters] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.parameters.serverLocalPath] Server Local path. + * + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' + * + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.parameters.friendlyName] Friendly Name + * + * @param {string} [options.parameters.serverResourceId] Server Resource Id. + * + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State + * + * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint + * lastWorkflowId + * + * @param {string} [options.parameters.lastOperationName] Resource Last + * Operation Name + * + * @param {object} [options.parameters.syncStatus] Sync Health Status + * + * @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?: { 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: { parameters? : 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; + + + /** + * 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. + */ + beginRecallActionWithHttpOperationResponse(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. + */ + beginRecallAction(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginRecallAction(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, callback: ServiceCallback): void; + beginRecallAction(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: 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 StorageSyncManagementClient. + */ +export interface RegisteredServers { + + + /** + * 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; + + + /** + * 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} parameters Body of Registered Server object. + * + * @param {string} [parameters.serverCertificate] Registered Server Certificate + * + * @param {string} [parameters.agentVersion] Registered Server Agent Version + * + * @param {string} [parameters.serverOSVersion] Registered Server OS Version + * + * @param {number} [parameters.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State + * + * @param {string} [parameters.serverRole] Registered Server serverRole + * + * @param {string} [parameters.clusterId] Registered Server clusterId + * + * @param {string} [parameters.clusterName] Registered Server clusterName + * + * @param {string} [parameters.serverId] Registered Server serverId + * + * @param {string} [parameters.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {string} [parameters.discoveryEndpointUri] Resource + * discoveryEndpointUri + * + * @param {string} [parameters.resourceLocation] Resource Location + * + * @param {string} [parameters.serviceLocation] Service Location + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, parameters: 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} parameters Body of Registered Server object. + * + * @param {string} [parameters.serverCertificate] Registered Server Certificate + * + * @param {string} [parameters.agentVersion] Registered Server Agent Version + * + * @param {string} [parameters.serverOSVersion] Registered Server OS Version + * + * @param {number} [parameters.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State + * + * @param {string} [parameters.serverRole] Registered Server serverRole + * + * @param {string} [parameters.clusterId] Registered Server clusterId + * + * @param {string} [parameters.clusterName] Registered Server clusterName + * + * @param {string} [parameters.serverId] Registered Server serverId + * + * @param {string} [parameters.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {string} [parameters.discoveryEndpointUri] Resource + * discoveryEndpointUri + * + * @param {string} [parameters.resourceLocation] Resource Location + * + * @param {string} [parameters.serviceLocation] Service Location + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri + * + * @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, 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; + + + /** + * 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} parameters Body of Registered Server object. + * + * @param {string} [parameters.serverCertificate] Registered Server Certificate + * + * @param {string} [parameters.agentVersion] Registered Server Agent Version + * + * @param {string} [parameters.serverOSVersion] Registered Server OS Version + * + * @param {number} [parameters.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State + * + * @param {string} [parameters.serverRole] Registered Server serverRole + * + * @param {string} [parameters.clusterId] Registered Server clusterId + * + * @param {string} [parameters.clusterName] Registered Server clusterName + * + * @param {string} [parameters.serverId] Registered Server serverId + * + * @param {string} [parameters.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {string} [parameters.discoveryEndpointUri] Resource + * discoveryEndpointUri + * + * @param {string} [parameters.resourceLocation] Resource Location + * + * @param {string} [parameters.serviceLocation] Service Location + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, parameters: 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} parameters Body of Registered Server object. + * + * @param {string} [parameters.serverCertificate] Registered Server Certificate + * + * @param {string} [parameters.agentVersion] Registered Server Agent Version + * + * @param {string} [parameters.serverOSVersion] Registered Server OS Version + * + * @param {number} [parameters.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State + * + * @param {string} [parameters.serverRole] Registered Server serverRole + * + * @param {string} [parameters.clusterId] Registered Server clusterId + * + * @param {string} [parameters.clusterName] Registered Server clusterName + * + * @param {string} [parameters.serverId] Registered Server serverId + * + * @param {string} [parameters.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {string} [parameters.discoveryEndpointUri] Resource + * discoveryEndpointUri + * + * @param {string} [parameters.resourceLocation] Resource Location + * + * @param {string} [parameters.serviceLocation] Service Location + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri + * + * @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, 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; + + + /** + * 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 StorageSyncManagementClient. + */ +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; + + + /** + * 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. + */ + abortWithHttpOperationResponse(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. + */ + 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 new file mode 100644 index 0000000000..9f76216fd2 --- /dev/null +++ b/lib/services/storagesyncmanagement/lib/operations/index.js @@ -0,0 +1,23 @@ +/* + * 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.Operations = require('./operations'); +exports.StorageSyncServices = require('./storageSyncServices'); +exports.SyncGroups = require('./syncGroups'); +exports.CloudEndpoints = require('./cloudEndpoints'); +exports.ServerEndpoints = require('./serverEndpoints'); +exports.RegisteredServers = require('./registeredServers'); +exports.Workflows = require('./workflows'); 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 new file mode 100644 index 0000000000..70c88485da --- /dev/null +++ b/lib/services/storagesyncmanagement/lib/operations/registeredServers.js @@ -0,0 +1,1659 @@ +/* + * 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['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. + * + * @param {string} resourceGroupName The name 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['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['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} parameters Body of Registered Server object. + * + * @param {string} [parameters.serverCertificate] Registered Server Certificate + * + * @param {string} [parameters.agentVersion] Registered Server Agent Version + * + * @param {string} [parameters.serverOSVersion] Registered Server OS Version + * + * @param {number} [parameters.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State + * + * @param {string} [parameters.serverRole] Registered Server serverRole + * + * @param {string} [parameters.clusterId] Registered Server clusterId + * + * @param {string} [parameters.clusterName] Registered Server clusterName + * + * @param {string} [parameters.serverId] Registered Server serverId + * + * @param {string} [parameters.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {string} [parameters.discoveryEndpointUri] Resource + * discoveryEndpointUri + * + * @param {string} [parameters.resourceLocation] Resource Location + * + * @param {string} [parameters.serviceLocation] Service Location + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri + * + * @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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreate(resourceGroupName, storageSyncServiceName, serverId, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['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} parameters Body of Registered Server object. + * + * @param {string} [parameters.serverCertificate] Registered Server Certificate + * + * @param {string} [parameters.agentVersion] Registered Server Agent Version + * + * @param {string} [parameters.serverOSVersion] Registered Server OS Version + * + * @param {number} [parameters.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State + * + * @param {string} [parameters.serverRole] Registered Server serverRole + * + * @param {string} [parameters.clusterId] Registered Server clusterId + * + * @param {string} [parameters.clusterName] Registered Server clusterName + * + * @param {string} [parameters.serverId] Registered Server serverId + * + * @param {string} [parameters.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {string} [parameters.discoveryEndpointUri] Resource + * discoveryEndpointUri + * + * @param {string} [parameters.resourceLocation] Resource Location + * + * @param {string} [parameters.serviceLocation] Service Location + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri + * + * @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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['RegisteredServer']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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['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['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 RegisteredServers. */ +class RegisteredServers { + /** + * Create a RegisteredServers. + * @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; + this._beginCreate = _beginCreate; + 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. + * + * @param {string} resourceGroupName The name 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} parameters Body of Registered Server object. + * + * @param {string} [parameters.serverCertificate] Registered Server Certificate + * + * @param {string} [parameters.agentVersion] Registered Server Agent Version + * + * @param {string} [parameters.serverOSVersion] Registered Server OS Version + * + * @param {number} [parameters.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State + * + * @param {string} [parameters.serverRole] Registered Server serverRole + * + * @param {string} [parameters.clusterId] Registered Server clusterId + * + * @param {string} [parameters.clusterName] Registered Server clusterName + * + * @param {string} [parameters.serverId] Registered Server serverId + * + * @param {string} [parameters.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {string} [parameters.discoveryEndpointUri] Resource + * discoveryEndpointUri + * + * @param {string} [parameters.resourceLocation] Resource Location + * + * @param {string} [parameters.serviceLocation] Service Location + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + 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); } + 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} parameters Body of Registered Server object. + * + * @param {string} [parameters.serverCertificate] Registered Server Certificate + * + * @param {string} [parameters.agentVersion] Registered Server Agent Version + * + * @param {string} [parameters.serverOSVersion] Registered Server OS Version + * + * @param {number} [parameters.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State + * + * @param {string} [parameters.serverRole] Registered Server serverRole + * + * @param {string} [parameters.clusterId] Registered Server clusterId + * + * @param {string} [parameters.clusterName] Registered Server clusterName + * + * @param {string} [parameters.serverId] Registered Server serverId + * + * @param {string} [parameters.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {string} [parameters.discoveryEndpointUri] Resource + * discoveryEndpointUri + * + * @param {string} [parameters.resourceLocation] Resource Location + * + * @param {string} [parameters.serviceLocation] Service Location + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri + * + * @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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._create(resourceGroupName, storageSyncServiceName, serverId, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, storageSyncServiceName, serverId, parameters, 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} parameters Body of Registered Server object. + * + * @param {string} [parameters.serverCertificate] Registered Server Certificate + * + * @param {string} [parameters.agentVersion] Registered Server Agent Version + * + * @param {string} [parameters.serverOSVersion] Registered Server OS Version + * + * @param {number} [parameters.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State + * + * @param {string} [parameters.serverRole] Registered Server serverRole + * + * @param {string} [parameters.clusterId] Registered Server clusterId + * + * @param {string} [parameters.clusterName] Registered Server clusterName + * + * @param {string} [parameters.serverId] Registered Server serverId + * + * @param {string} [parameters.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {string} [parameters.discoveryEndpointUri] Resource + * discoveryEndpointUri + * + * @param {string} [parameters.resourceLocation] Resource Location + * + * @param {string} [parameters.serviceLocation] Service Location + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + 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); } + 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} parameters Body of Registered Server object. + * + * @param {string} [parameters.serverCertificate] Registered Server Certificate + * + * @param {string} [parameters.agentVersion] Registered Server Agent Version + * + * @param {string} [parameters.serverOSVersion] Registered Server OS Version + * + * @param {number} [parameters.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State + * + * @param {string} [parameters.serverRole] Registered Server serverRole + * + * @param {string} [parameters.clusterId] Registered Server clusterId + * + * @param {string} [parameters.clusterName] Registered Server clusterName + * + * @param {string} [parameters.serverId] Registered Server serverId + * + * @param {string} [parameters.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {string} [parameters.discoveryEndpointUri] Resource + * discoveryEndpointUri + * + * @param {string} [parameters.resourceLocation] Resource Location + * + * @param {string} [parameters.serviceLocation] Service Location + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri + * + * @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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreate(resourceGroupName, storageSyncServiceName, serverId, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreate(resourceGroupName, storageSyncServiceName, serverId, parameters, 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/serverEndpoints.js b/lib/services/storagesyncmanagement/lib/operations/serverEndpoints.js new file mode 100644 index 0000000000..020e7a6d1c --- /dev/null +++ b/lib/services/storagesyncmanagement/lib/operations/serverEndpoints.js @@ -0,0 +1,2645 @@ +/* + * 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} parameters Body of Server Endpoint object. + * + * @param {string} [parameters.serverLocalPath] Server Local path. + * + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.serverResourceId] Server Resource Id. + * + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {object} [parameters.syncStatus] Sync Health Status + * + * @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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['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.parameters] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.parameters.serverLocalPath] Server Local path. + * + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' + * + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.parameters.friendlyName] Friendly Name + * + * @param {string} [options.parameters.serverResourceId] Server Resource Id. + * + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State + * + * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint + * lastWorkflowId + * + * @param {string} [options.parameters.lastOperationName] Resource Last + * Operation Name + * + * @param {object} [options.parameters.syncStatus] Sync Health Status + * + * @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['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['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); + }); + }); +} + +/** + * 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 _recallAction(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.beginRecallAction(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} parameters Body of Server Endpoint object. + * + * @param {string} [parameters.serverLocalPath] Server Local path. + * + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.serverResourceId] Server Resource Id. + * + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {object} [parameters.syncStatus] Sync Health Status + * + * @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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ServerEndpoint']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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['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.parameters] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.parameters.serverLocalPath] Server Local path. + * + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' + * + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.parameters.friendlyName] Friendly Name + * + * @param {string} [options.parameters.serverResourceId] Server Resource Id. + * + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State + * + * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint + * lastWorkflowId + * + * @param {string} [options.parameters.lastOperationName] Resource Last + * Operation Name + * + * @param {object} [options.parameters.syncStatus] Sync Health Status + * + * @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 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') { + 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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ServerEndpoint']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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['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['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); + }); +} + +/** + * 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 _beginRecallAction(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._recallAction = _recallAction; + this._beginCreate = _beginCreate; + this._beginUpdate = _beginUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginRecallAction = _beginRecallAction; + } + + /** + * 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} parameters Body of Server Endpoint object. + * + * @param {string} [parameters.serverLocalPath] Server Local path. + * + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.serverResourceId] Server Resource Id. + * + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {object} [parameters.syncStatus] Sync Health Status + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + 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); } + 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} parameters Body of Server Endpoint object. + * + * @param {string} [parameters.serverLocalPath] Server Local path. + * + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.serverResourceId] Server Resource Id. + * + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {object} [parameters.syncStatus] Sync Health Status + * + * @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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._create(resourceGroupName, 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, parameters, 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.parameters] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.parameters.serverLocalPath] Server Local path. + * + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' + * + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.parameters.friendlyName] Friendly Name + * + * @param {string} [options.parameters.serverResourceId] Server Resource Id. + * + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State + * + * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint + * lastWorkflowId + * + * @param {string} [options.parameters.lastOperationName] Resource Last + * Operation Name + * + * @param {object} [options.parameters.syncStatus] Sync Health Status + * + * @param {object} [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.parameters] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.parameters.serverLocalPath] Server Local path. + * + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' + * + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.parameters.friendlyName] Friendly Name + * + * @param {string} [options.parameters.serverResourceId] Server Resource Id. + * + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State + * + * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint + * lastWorkflowId + * + * @param {string} [options.parameters.lastOperationName] Resource Last + * Operation Name + * + * @param {object} [options.parameters.syncStatus] Sync Health Status + * + * @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); + } + } + + /** + * 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); + } + } + + /** + * 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. + */ + recallActionWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._recallAction(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. + */ + recallAction(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._recallAction(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._recallAction(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} parameters Body of Server Endpoint object. + * + * @param {string} [parameters.serverLocalPath] Server Local path. + * + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.serverResourceId] Server Resource Id. + * + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {object} [parameters.syncStatus] Sync Health Status + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + 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); } + 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} parameters Body of Server Endpoint object. + * + * @param {string} [parameters.serverLocalPath] Server Local path. + * + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.serverResourceId] Server Resource Id. + * + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {object} [parameters.syncStatus] Sync Health Status + * + * @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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreate(resourceGroupName, 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, parameters, 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.parameters] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.parameters.serverLocalPath] Server Local path. + * + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' + * + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.parameters.friendlyName] Friendly Name + * + * @param {string} [options.parameters.serverResourceId] Server Resource Id. + * + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State + * + * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint + * lastWorkflowId + * + * @param {string} [options.parameters.lastOperationName] Resource Last + * Operation Name + * + * @param {object} [options.parameters.syncStatus] Sync Health Status + * + * @param {object} [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.parameters] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.parameters.serverLocalPath] Server Local path. + * + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' + * + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.parameters.friendlyName] Friendly Name + * + * @param {string} [options.parameters.serverResourceId] Server Resource Id. + * + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State + * + * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint + * lastWorkflowId + * + * @param {string} [options.parameters.lastOperationName] Resource Last + * Operation Name + * + * @param {object} [options.parameters.syncStatus] Sync Health Status + * + * @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); + } + } + + /** + * 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. + */ + beginRecallActionWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginRecallAction(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. + */ + beginRecallAction(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._beginRecallAction(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginRecallAction(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 new file mode 100644 index 0000000000..3dffc26791 --- /dev/null +++ b/lib/services/storagesyncmanagement/lib/operations/storageSyncServices.js @@ -0,0 +1,1783 @@ +/* + * 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; + +/** + * Check the give namespace name availability. + * + * @param {string} locationName The desired region for the name check. + * + * @param {object} parameters Parameters to check availability of the given + * namespace name + * + * @param {string} parameters.name The name to check for availability + * + * @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 CheckNameAvailabilityResult} for more + * information. + * + * {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 _checkNameAvailability(locationName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + if (parameters === null || parameters === undefined) + { + parameters = {}; + } + // Validate + try { + if (locationName === null || locationName === undefined || typeof locationName.valueOf() !== 'string') { + throw new Error('locationName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/locations/{locationName}/checkNameAvailability'; + requestUrl = requestUrl.replace('{locationName}', encodeURIComponent(locationName)); + 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 = '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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['CheckNameAvailabilityParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['CheckNameAvailabilityResult']().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 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} parameters 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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['StorageSyncService']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + 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['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['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['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.parameters] 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 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') { + 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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['StorageSyncService']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + 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['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['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); + }); +} + +/** + * 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 {StorageSyncManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._checkNameAvailability = _checkNameAvailability; + this._create = _create; + this._get = _get; + this._update = _update; + this._deleteMethod = _deleteMethod; + this._listByResourceGroup = _listByResourceGroup; + this._listBySubscription = _listBySubscription; + } + + /** + * Check the give namespace name availability. + * + * @param {string} locationName The desired region for the name check. + * + * @param {object} parameters Parameters to check availability of the given + * namespace name + * + * @param {string} parameters.name The name to check for availability + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + checkNameAvailabilityWithHttpOperationResponse(locationName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._checkNameAvailability(locationName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Check the give namespace name availability. + * + * @param {string} locationName The desired region for the name check. + * + * @param {object} parameters Parameters to check availability of the given + * namespace name + * + * @param {string} parameters.name The name to check for availability + * + * @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 {CheckNameAvailabilityResult} - 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 CheckNameAvailabilityResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + checkNameAvailability(locationName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._checkNameAvailability(locationName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._checkNameAvailability(locationName, parameters, options, optionalCallback); + } + } + + /** + * 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} parameters 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, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._create(resourceGroupName, storageSyncServiceName, parameters, 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} parameters 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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._create(resourceGroupName, storageSyncServiceName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, storageSyncServiceName, parameters, 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.parameters] 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.parameters] 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); + } + } + + /** + * 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 new file mode 100644 index 0000000000..5403647273 --- /dev/null +++ b/lib/services/storagesyncmanagement/lib/operations/syncGroups.js @@ -0,0 +1,1081 @@ +/* + * 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['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. + * + * @param {string} resourceGroupName The name 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} parameters Sync Group Body + * + * @param {string} [parameters.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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['SyncGroup']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + 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['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['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['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['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 SyncGroups. */ +class SyncGroups { + /** + * Create a SyncGroups. + * @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. + * + * @param {string} resourceGroupName The name 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} parameters Sync Group Body + * + * @param {string} [parameters.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, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + 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); } + 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} parameters Sync Group Body + * + * @param {string} [parameters.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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._create(resourceGroupName, storageSyncServiceName, syncGroupName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, storageSyncServiceName, syncGroupName, parameters, 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..7786329153 --- /dev/null +++ b/lib/services/storagesyncmanagement/lib/operations/workflows.js @@ -0,0 +1,536 @@ +/* + * 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['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['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); + }); +} + +/** + * 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 {StorageSyncManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._abort = _abort; + } + + /** + * 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); + } + } + + /** + * 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..d2c20ef7ba --- /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 = '2018-04-02'; + 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 new file mode 100644 index 0000000000..549ae20014 --- /dev/null +++ b/lib/services/storagesyncmanagement/package.json @@ -0,0 +1,25 @@ +{ + "name": "azure-arm-storagesyncmanagement", + "author": "Microsoft Corporation", + "description": "StorageSyncManagementClient Library with typescript type definitions for node", + "version": "1.1.0", + "dependencies": { + "ms-rest": "^2.3.3", + "ms-rest-azure": "^2.5.5" + }, + "keywords": [ + "node", + "azure" + ], + "license": "MIT", + "main": "./lib/storageSyncManagementClient.js", + "types": "./lib/storageSyncManagementClient.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 e332d6dc2aaae9f02c8037423189aa44726dbec5 Mon Sep 17 00:00:00 2001 From: Dan Schulte Date: Mon, 20 Aug 2018 10:30:16 -0700 Subject: [PATCH 3/5] Regenerate azure-arm-storagesync --- .../lib/models/cloudEndpoint.js | 8 + .../lib/models/index.d.ts | 80 ++- .../storagesyncManagement/lib/models/index.js | 2 + .../lib/models/operationEntity.js | 2 - .../lib/models/postRestoreRequest.js | 2 - .../lib/models/preRestoreRequest.js | 2 - .../lib/models/registeredServer.js | 48 ++ .../lib/models/serverEndpoint.js | 116 +--- .../lib/models/storageSyncError.js | 2 - .../lib/models/workflowArray.js | 2 - .../lib/operations/cloudEndpoints.js | 26 +- .../lib/operations/index.d.ts | 446 +++++-------- .../lib/operations/registeredServers.js | 78 +++ .../lib/operations/serverEndpoints.js | 474 ++------------ .../lib/operations/storageSyncServices.js | 260 ++++++++ .../lib/storageSyncManagementClient.d.ts | 6 +- .../lib/storageSyncManagementClient.js | 8 +- .../storagesyncManagement/package.json | 4 +- lib/services/storagesyncmanagement/README.md | 6 +- .../lib/microsoftStorageSync.d.ts | 81 +++ .../lib/microsoftStorageSync.js | 104 +++ .../lib/models/errorDetails.js | 68 ++ .../lib/models/errorModel.js | 74 +++ .../lib/models/operationEntity.js | 2 - .../lib/models/postRestoreRequest.js | 2 - .../lib/models/preRestoreRequest.js | 2 - .../lib/models/storageSyncError.js | 2 - .../lib/models/workflowArray.js | 2 - .../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/cloudEndpointsGet.js | 292 +++++++++ .../lib/operations/getSyncGroups.js | 282 ++++++++ .../lib/operations/operationGet.js | 455 +++++++++++++ .../lib/operations/registeredServersGet.js | 282 ++++++++ .../lib/operations/serverEndpointRecall.js | 450 +++++++++++++ .../lib/operations/serverEndpointsGet.js | 292 +++++++++ .../storageSyncServiceByResourceGroupGet.js | 271 ++++++++ .../lib/operations/storageSyncServiceGet.js | 244 +++++++ .../lib/storageSyncManagementClient.d.ts | 6 +- .../lib/storageSyncManagementClient.js | 6 +- .../storagesyncmanagement/package-lock.json | 483 ++++++++++++++ .../storagesyncmanagement/package.json | 8 +- 46 files changed, 6882 insertions(+), 857 deletions(-) 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/errorDetails.js create mode 100644 lib/services/storagesyncmanagement/lib/models/errorModel.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/cloudEndpointsGet.js create mode 100644 lib/services/storagesyncmanagement/lib/operations/getSyncGroups.js create mode 100644 lib/services/storagesyncmanagement/lib/operations/operationGet.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/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/package-lock.json diff --git a/lib/services/storagesyncManagement/lib/models/cloudEndpoint.js b/lib/services/storagesyncManagement/lib/models/cloudEndpoint.js index c4a7a1a1d5..8143070314 100644 --- a/lib/services/storagesyncManagement/lib/models/cloudEndpoint.js +++ b/lib/services/storagesyncManagement/lib/models/cloudEndpoint.js @@ -30,6 +30,7 @@ class CloudEndpoint extends models['BaseResource'] { * @member {boolean} [backupEnabled] Backup Enabled * @member {string} [provisioningState] CloudEndpoint Provisioning State * @member {string} [lastWorkflowId] CloudEndpoint lastWorkflowId + * @member {string} [lastOperationName] Resource Last Operation Name */ constructor() { super(); @@ -119,6 +120,13 @@ class CloudEndpoint extends models['BaseResource'] { type: { name: 'String' } + }, + lastOperationName: { + required: false, + serializedName: 'properties.lastOperationName', + type: { + name: 'String' + } } } } diff --git a/lib/services/storagesyncManagement/lib/models/index.d.ts b/lib/services/storagesyncManagement/lib/models/index.d.ts index e263c38525..739d5206e3 100644 --- a/lib/services/storagesyncManagement/lib/models/index.d.ts +++ b/lib/services/storagesyncManagement/lib/models/index.d.ts @@ -142,6 +142,7 @@ export interface SyncGroup extends BaseResource { * @member {boolean} [backupEnabled] Backup Enabled * @member {string} [provisioningState] CloudEndpoint Provisioning State * @member {string} [lastWorkflowId] CloudEndpoint lastWorkflowId + * @member {string} [lastOperationName] Resource Last Operation Name */ export interface CloudEndpoint extends BaseResource { storageAccountKey?: string; @@ -154,6 +155,7 @@ export interface CloudEndpoint extends BaseResource { readonly backupEnabled?: boolean; provisioningState?: string; lastWorkflowId?: string; + lastOperationName?: string; } /** @@ -168,46 +170,22 @@ export interface CloudEndpoint extends BaseResource { * @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 + * @member {string} [lastOperationName] Resource Last Operation Name + * @member {object} [syncStatus] Sync Health Status */ 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; + lastOperationName?: string; + syncStatus?: any; } /** @@ -233,6 +211,12 @@ export interface ServerEndpoint extends BaseResource { * @member {string} [storageSyncServiceUid] Registered Server * storageSyncServiceUid * @member {string} [lastWorkflowId] Registered Server lastWorkflowId + * @member {string} [lastOperationName] Resource Last Operation Name + * @member {string} [discoveryEndpointUri] Resource discoveryEndpointUri + * @member {string} [resourceLocation] Resource Location + * @member {string} [serviceLocation] Service Location + * @member {string} [friendlyName] Friendly Name + * @member {string} [managementEndpointUri] Management Endpoint Uri */ export interface RegisteredServer extends BaseResource { readonly id?: string; @@ -250,6 +234,12 @@ export interface RegisteredServer extends BaseResource { serverId?: string; storageSyncServiceUid?: string; lastWorkflowId?: string; + lastOperationName?: string; + discoveryEndpointUri?: string; + resourceLocation?: string; + serviceLocation?: string; + friendlyName?: string; + managementEndpointUri?: string; } /** @@ -347,6 +337,40 @@ export interface OperationDisplayResource { description?: string; } +/** + * @class + * Initializes a new instance of the CheckNameAvailabilityParameters class. + * @constructor + * Parameters for a check name availability request. + * + * @member {string} name The name to check for availability + */ +export interface CheckNameAvailabilityParameters { + name: string; +} + +/** + * @class + * Initializes a new instance of the CheckNameAvailabilityResult class. + * @constructor + * The CheckNameAvailability operation response. + * + * @member {boolean} [nameAvailable] Gets a boolean value that indicates + * whether the name is available for you to use. If true, the name is + * available. If false, the name has already been taken or invalid and cannot + * be used. + * @member {string} [reason] Gets the reason that a Storage Sync Service name + * could not be used. The Reason element is only returned if NameAvailable is + * false. Possible values include: 'Invalid', 'AlreadyExists' + * @member {string} [message] Gets an error message explaining the Reason value + * in more detail. + */ +export interface CheckNameAvailabilityResult { + readonly nameAvailable?: boolean; + readonly reason?: string; + readonly message?: string; +} + /** * @class * Initializes a new instance of the RestoreFileSpec class. diff --git a/lib/services/storagesyncManagement/lib/models/index.js b/lib/services/storagesyncManagement/lib/models/index.js index 6c83dfd4ac..e4896fad4c 100644 --- a/lib/services/storagesyncManagement/lib/models/index.js +++ b/lib/services/storagesyncManagement/lib/models/index.js @@ -33,6 +33,8 @@ exports.Workflow = require('./workflow'); exports.OperationDisplayInfo = require('./operationDisplayInfo'); exports.OperationEntity = require('./operationEntity'); exports.OperationDisplayResource = require('./operationDisplayResource'); +exports.CheckNameAvailabilityParameters = require('./checkNameAvailabilityParameters'); +exports.CheckNameAvailabilityResult = require('./checkNameAvailabilityResult'); exports.RestoreFileSpec = require('./restoreFileSpec'); exports.PostRestoreRequest = require('./postRestoreRequest'); exports.PreRestoreRequest = require('./preRestoreRequest'); diff --git a/lib/services/storagesyncManagement/lib/models/operationEntity.js b/lib/services/storagesyncManagement/lib/models/operationEntity.js index 8d29602603..e7a1b503f7 100644 --- a/lib/services/storagesyncManagement/lib/models/operationEntity.js +++ b/lib/services/storagesyncManagement/lib/models/operationEntity.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The operation supported by storage sync. * diff --git a/lib/services/storagesyncManagement/lib/models/postRestoreRequest.js b/lib/services/storagesyncManagement/lib/models/postRestoreRequest.js index 82450187a5..32be654193 100644 --- a/lib/services/storagesyncManagement/lib/models/postRestoreRequest.js +++ b/lib/services/storagesyncManagement/lib/models/postRestoreRequest.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * Post Restore Request * diff --git a/lib/services/storagesyncManagement/lib/models/preRestoreRequest.js b/lib/services/storagesyncManagement/lib/models/preRestoreRequest.js index 3afda3c8b9..47c2c0e206 100644 --- a/lib/services/storagesyncManagement/lib/models/preRestoreRequest.js +++ b/lib/services/storagesyncManagement/lib/models/preRestoreRequest.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * Pre Restore request object. * diff --git a/lib/services/storagesyncManagement/lib/models/registeredServer.js b/lib/services/storagesyncManagement/lib/models/registeredServer.js index 6edbd83efb..cfa338c603 100644 --- a/lib/services/storagesyncManagement/lib/models/registeredServer.js +++ b/lib/services/storagesyncManagement/lib/models/registeredServer.js @@ -37,6 +37,12 @@ class RegisteredServer extends models['BaseResource'] { * @member {string} [storageSyncServiceUid] Registered Server * storageSyncServiceUid * @member {string} [lastWorkflowId] Registered Server lastWorkflowId + * @member {string} [lastOperationName] Resource Last Operation Name + * @member {string} [discoveryEndpointUri] Resource discoveryEndpointUri + * @member {string} [resourceLocation] Resource Location + * @member {string} [serviceLocation] Service Location + * @member {string} [friendlyName] Friendly Name + * @member {string} [managementEndpointUri] Management Endpoint Uri */ constructor() { super(); @@ -163,6 +169,48 @@ class RegisteredServer extends models['BaseResource'] { type: { name: 'String' } + }, + lastOperationName: { + required: false, + serializedName: 'properties.lastOperationName', + type: { + name: 'String' + } + }, + discoveryEndpointUri: { + required: false, + serializedName: 'properties.discoveryEndpointUri', + type: { + name: 'String' + } + }, + resourceLocation: { + required: false, + serializedName: 'properties.resourceLocation', + type: { + name: 'String' + } + }, + serviceLocation: { + required: false, + serializedName: 'properties.serviceLocation', + type: { + name: 'String' + } + }, + friendlyName: { + required: false, + serializedName: 'properties.friendlyName', + type: { + name: 'String' + } + }, + managementEndpointUri: { + required: false, + serializedName: 'properties.managementEndpointUri', + type: { + name: 'String' + } } } } diff --git a/lib/services/storagesyncManagement/lib/models/serverEndpoint.js b/lib/services/storagesyncManagement/lib/models/serverEndpoint.js index 974b6dea4f..98554e6aa1 100644 --- a/lib/services/storagesyncManagement/lib/models/serverEndpoint.js +++ b/lib/services/storagesyncManagement/lib/models/serverEndpoint.js @@ -26,24 +26,11 @@ class ServerEndpoint extends models['BaseResource'] { * @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 + * @member {string} [lastOperationName] Resource Last Operation Name + * @member {object} [syncStatus] Sync Health Status */ constructor() { super(); @@ -95,116 +82,39 @@ class ServerEndpoint extends models['BaseResource'] { 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: { + serverResourceId: { required: false, - serializedName: 'properties.syncErrorContext', + serializedName: 'properties.serverResourceId', type: { name: 'String' } }, - currentProgressType: { + provisioningState: { required: false, - serializedName: 'properties.currentProgressType', + serializedName: 'properties.provisioningState', 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: { + lastWorkflowId: { required: false, - serializedName: 'properties.serverResourceId', + serializedName: 'properties.lastWorkflowId', type: { name: 'String' } }, - provisioningState: { + lastOperationName: { required: false, - serializedName: 'properties.provisioningState', + serializedName: 'properties.lastOperationName', type: { name: 'String' } }, - lastWorkflowId: { + syncStatus: { required: false, - serializedName: 'properties.lastWorkflowId', + serializedName: 'properties.syncStatus', type: { - name: 'String' + name: 'Object' } } } diff --git a/lib/services/storagesyncManagement/lib/models/storageSyncError.js b/lib/services/storagesyncManagement/lib/models/storageSyncError.js index 509d940f23..b185128307 100644 --- a/lib/services/storagesyncManagement/lib/models/storageSyncError.js +++ b/lib/services/storagesyncManagement/lib/models/storageSyncError.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * Error type * diff --git a/lib/services/storagesyncManagement/lib/models/workflowArray.js b/lib/services/storagesyncManagement/lib/models/workflowArray.js index 698149ba59..c2c3eb737f 100644 --- a/lib/services/storagesyncManagement/lib/models/workflowArray.js +++ b/lib/services/storagesyncManagement/lib/models/workflowArray.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * Array of Workflow * diff --git a/lib/services/storagesyncManagement/lib/operations/cloudEndpoints.js b/lib/services/storagesyncManagement/lib/operations/cloudEndpoints.js index 99dc355613..3227f0ef9f 100644 --- a/lib/services/storagesyncManagement/lib/operations/cloudEndpoints.js +++ b/lib/services/storagesyncManagement/lib/operations/cloudEndpoints.js @@ -52,6 +52,8 @@ const WebResource = msRest.WebResource; * * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -818,7 +820,7 @@ function _preRestore(resourceGroupName, storageSyncServiceName, syncGroupName, c * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _restoreHeatbeat(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, callback) { +function _restoreheartbeat(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -1072,6 +1074,8 @@ function _postRestore(resourceGroupName, storageSyncServiceName, syncGroupName, * * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -2186,7 +2190,7 @@ class CloudEndpoints { this._preBackup = _preBackup; this._postBackup = _postBackup; this._preRestore = _preRestore; - this._restoreHeatbeat = _restoreHeatbeat; + this._restoreheartbeat = _restoreheartbeat; this._postRestore = _postRestore; this._beginCreate = _beginCreate; this._beginDeleteMethod = _beginDeleteMethod; @@ -2233,6 +2237,8 @@ class CloudEndpoints { * * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -2295,6 +2301,8 @@ class CloudEndpoints { * * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -3013,11 +3021,11 @@ class CloudEndpoints { * * @reject {Error} - The error object. */ - restoreHeatbeatWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options) { + restoreheartbeatWithHttpOperationResponse(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) => { + self._restoreheartbeat(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -3066,7 +3074,7 @@ class CloudEndpoints { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - restoreHeatbeat(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, optionalCallback) { + restoreheartbeat(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -3075,14 +3083,14 @@ class CloudEndpoints { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._restoreHeatbeat(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, (err, result, request, response) => { + self._restoreheartbeat(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); + return self._restoreheartbeat(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, optionalCallback); } } @@ -3264,6 +3272,8 @@ class CloudEndpoints { * * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -3326,6 +3336,8 @@ class CloudEndpoints { * * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the diff --git a/lib/services/storagesyncManagement/lib/operations/index.d.ts b/lib/services/storagesyncManagement/lib/operations/index.d.ts index 1bf2a332ab..74d7e97dc0 100644 --- a/lib/services/storagesyncManagement/lib/operations/index.d.ts +++ b/lib/services/storagesyncManagement/lib/operations/index.d.ts @@ -140,6 +140,72 @@ export interface Operations { export interface StorageSyncServices { + /** + * Check the give namespace name availability. + * + * @param {string} locationName The desired region for the name check. + * + * @param {object} parameters Parameters to check availability of the given + * namespace name + * + * @param {string} parameters.name The name to check for availability + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + checkNameAvailabilityWithHttpOperationResponse(locationName: string, parameters: models.CheckNameAvailabilityParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Check the give namespace name availability. + * + * @param {string} locationName The desired region for the name check. + * + * @param {object} parameters Parameters to check availability of the given + * namespace name + * + * @param {string} parameters.name The name to check for availability + * + * @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 {CheckNameAvailabilityResult} - 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. + * + * {CheckNameAvailabilityResult} [result] - The deserialized result object if an error did not occur. + * See {@link CheckNameAvailabilityResult} 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. + */ + checkNameAvailability(locationName: string, parameters: models.CheckNameAvailabilityParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + checkNameAvailability(locationName: string, parameters: models.CheckNameAvailabilityParameters, callback: ServiceCallback): void; + checkNameAvailability(locationName: string, parameters: models.CheckNameAvailabilityParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + /** * Create a new StorageSyncService. * @@ -835,6 +901,8 @@ export interface CloudEndpoints { * * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -885,6 +953,8 @@ export interface CloudEndpoints { * * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1426,7 +1496,7 @@ export interface CloudEndpoints { * * @reject {Error|ServiceError} - The error object. */ - restoreHeatbeatWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + restoreheartbeatWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Restore Heartbeat a given CloudEndpoint. @@ -1467,9 +1537,9 @@ export interface CloudEndpoints { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - 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; + restoreheartbeat(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + restoreheartbeat(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, callback: ServiceCallback): void; + restoreheartbeat(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -1623,6 +1693,8 @@ export interface CloudEndpoints { * * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1673,6 +1745,8 @@ export interface CloudEndpoints { * * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -2200,38 +2274,6 @@ export interface ServerEndpoints { * * @param {string} [parameters.friendlyName] Friendly Name * - * @param {date} [parameters.lastSyncSuccess] Last Sync Success - * - * @param {string} [parameters.syncErrorState] Sync Error State - * - * @param {date} [parameters.syncErrorStateTimestamp] Sync Error State - * Timestamp - * - * @param {string} [parameters.syncErrorDirection] Sync Error Direction. - * Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' - * - * @param {number} [parameters.itemUploadErrorCount] Item Upload Error Count. - * - * @param {number} [parameters.itemDownloadErrorCount] Item download error - * count. - * - * @param {string} [parameters.syncErrorContext] sync error context. - * - * @param {string} [parameters.currentProgressType] current progress type. - * Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' - * - * @param {number} [parameters.itemProgressCount] Item Progress Count - * - * @param {number} [parameters.itemTotalCount] Item Total Count - * - * @param {number} [parameters.byteProgress] Bytes in progress - * - * @param {number} [parameters.totalProgress] Total progress - * - * @param {number} [parameters.byteTotal] Bytes total - * * @param {string} [parameters.serverResourceId] Server Resource Id. * * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning @@ -2239,6 +2281,10 @@ export interface ServerEndpoints { * * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {object} [parameters.syncStatus] Sync Health Status + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -2277,38 +2323,6 @@ export interface ServerEndpoints { * * @param {string} [parameters.friendlyName] Friendly Name * - * @param {date} [parameters.lastSyncSuccess] Last Sync Success - * - * @param {string} [parameters.syncErrorState] Sync Error State - * - * @param {date} [parameters.syncErrorStateTimestamp] Sync Error State - * Timestamp - * - * @param {string} [parameters.syncErrorDirection] Sync Error Direction. - * Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' - * - * @param {number} [parameters.itemUploadErrorCount] Item Upload Error Count. - * - * @param {number} [parameters.itemDownloadErrorCount] Item download error - * count. - * - * @param {string} [parameters.syncErrorContext] sync error context. - * - * @param {string} [parameters.currentProgressType] current progress type. - * Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' - * - * @param {number} [parameters.itemProgressCount] Item Progress Count - * - * @param {number} [parameters.itemTotalCount] Item Total Count - * - * @param {number} [parameters.byteProgress] Bytes in progress - * - * @param {number} [parameters.totalProgress] Total progress - * - * @param {number} [parameters.byteTotal] Bytes total - * * @param {string} [parameters.serverResourceId] Server Resource Id. * * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning @@ -2316,6 +2330,10 @@ export interface ServerEndpoints { * * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {object} [parameters.syncStatus] Sync Health Status + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -2376,39 +2394,6 @@ export interface ServerEndpoints { * * @param {string} [options.parameters.friendlyName] Friendly Name * - * @param {date} [options.parameters.lastSyncSuccess] Last Sync Success - * - * @param {string} [options.parameters.syncErrorState] Sync Error State - * - * @param {date} [options.parameters.syncErrorStateTimestamp] Sync Error State - * Timestamp - * - * @param {string} [options.parameters.syncErrorDirection] Sync Error - * Direction. Possible values include: 'none', 'initialize', 'download', - * 'upload', 'recall' - * - * @param {number} [options.parameters.itemUploadErrorCount] Item Upload Error - * Count. - * - * @param {number} [options.parameters.itemDownloadErrorCount] Item download - * error count. - * - * @param {string} [options.parameters.syncErrorContext] sync error context. - * - * @param {string} [options.parameters.currentProgressType] current progress - * type. Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' - * - * @param {number} [options.parameters.itemProgressCount] Item Progress Count - * - * @param {number} [options.parameters.itemTotalCount] Item Total Count - * - * @param {number} [options.parameters.byteProgress] Bytes in progress - * - * @param {number} [options.parameters.totalProgress] Total progress - * - * @param {number} [options.parameters.byteTotal] Bytes total - * * @param {string} [options.parameters.serverResourceId] Server Resource Id. * * @param {string} [options.parameters.provisioningState] ServerEndpoint @@ -2417,6 +2402,11 @@ export interface ServerEndpoints { * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint * lastWorkflowId * + * @param {string} [options.parameters.lastOperationName] Resource Last + * Operation Name + * + * @param {object} [options.parameters.syncStatus] Sync Health Status + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -2456,39 +2446,6 @@ export interface ServerEndpoints { * * @param {string} [options.parameters.friendlyName] Friendly Name * - * @param {date} [options.parameters.lastSyncSuccess] Last Sync Success - * - * @param {string} [options.parameters.syncErrorState] Sync Error State - * - * @param {date} [options.parameters.syncErrorStateTimestamp] Sync Error State - * Timestamp - * - * @param {string} [options.parameters.syncErrorDirection] Sync Error - * Direction. Possible values include: 'none', 'initialize', 'download', - * 'upload', 'recall' - * - * @param {number} [options.parameters.itemUploadErrorCount] Item Upload Error - * Count. - * - * @param {number} [options.parameters.itemDownloadErrorCount] Item download - * error count. - * - * @param {string} [options.parameters.syncErrorContext] sync error context. - * - * @param {string} [options.parameters.currentProgressType] current progress - * type. Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' - * - * @param {number} [options.parameters.itemProgressCount] Item Progress Count - * - * @param {number} [options.parameters.itemTotalCount] Item Total Count - * - * @param {number} [options.parameters.byteProgress] Bytes in progress - * - * @param {number} [options.parameters.totalProgress] Total progress - * - * @param {number} [options.parameters.byteTotal] Bytes total - * * @param {string} [options.parameters.serverResourceId] Server Resource Id. * * @param {string} [options.parameters.provisioningState] ServerEndpoint @@ -2497,6 +2454,11 @@ export interface ServerEndpoints { * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint * lastWorkflowId * + * @param {string} [options.parameters.lastOperationName] Resource Last + * Operation Name + * + * @param {object} [options.parameters.syncStatus] Sync Health Status + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -2759,7 +2721,7 @@ export interface ServerEndpoints { * * @reject {Error|ServiceError} - The error object. */ - recallWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + recallActionWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Recall a serverendpoint. @@ -2800,9 +2762,9 @@ export interface ServerEndpoints { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - 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; + recallAction(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + recallAction(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, callback: ServiceCallback): void; + recallAction(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -2830,38 +2792,6 @@ export interface ServerEndpoints { * * @param {string} [parameters.friendlyName] Friendly Name * - * @param {date} [parameters.lastSyncSuccess] Last Sync Success - * - * @param {string} [parameters.syncErrorState] Sync Error State - * - * @param {date} [parameters.syncErrorStateTimestamp] Sync Error State - * Timestamp - * - * @param {string} [parameters.syncErrorDirection] Sync Error Direction. - * Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' - * - * @param {number} [parameters.itemUploadErrorCount] Item Upload Error Count. - * - * @param {number} [parameters.itemDownloadErrorCount] Item download error - * count. - * - * @param {string} [parameters.syncErrorContext] sync error context. - * - * @param {string} [parameters.currentProgressType] current progress type. - * Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' - * - * @param {number} [parameters.itemProgressCount] Item Progress Count - * - * @param {number} [parameters.itemTotalCount] Item Total Count - * - * @param {number} [parameters.byteProgress] Bytes in progress - * - * @param {number} [parameters.totalProgress] Total progress - * - * @param {number} [parameters.byteTotal] Bytes total - * * @param {string} [parameters.serverResourceId] Server Resource Id. * * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning @@ -2869,6 +2799,10 @@ export interface ServerEndpoints { * * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {object} [parameters.syncStatus] Sync Health Status + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -2907,38 +2841,6 @@ export interface ServerEndpoints { * * @param {string} [parameters.friendlyName] Friendly Name * - * @param {date} [parameters.lastSyncSuccess] Last Sync Success - * - * @param {string} [parameters.syncErrorState] Sync Error State - * - * @param {date} [parameters.syncErrorStateTimestamp] Sync Error State - * Timestamp - * - * @param {string} [parameters.syncErrorDirection] Sync Error Direction. - * Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' - * - * @param {number} [parameters.itemUploadErrorCount] Item Upload Error Count. - * - * @param {number} [parameters.itemDownloadErrorCount] Item download error - * count. - * - * @param {string} [parameters.syncErrorContext] sync error context. - * - * @param {string} [parameters.currentProgressType] current progress type. - * Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' - * - * @param {number} [parameters.itemProgressCount] Item Progress Count - * - * @param {number} [parameters.itemTotalCount] Item Total Count - * - * @param {number} [parameters.byteProgress] Bytes in progress - * - * @param {number} [parameters.totalProgress] Total progress - * - * @param {number} [parameters.byteTotal] Bytes total - * * @param {string} [parameters.serverResourceId] Server Resource Id. * * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning @@ -2946,6 +2848,10 @@ export interface ServerEndpoints { * * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {object} [parameters.syncStatus] Sync Health Status + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -3006,39 +2912,6 @@ export interface ServerEndpoints { * * @param {string} [options.parameters.friendlyName] Friendly Name * - * @param {date} [options.parameters.lastSyncSuccess] Last Sync Success - * - * @param {string} [options.parameters.syncErrorState] Sync Error State - * - * @param {date} [options.parameters.syncErrorStateTimestamp] Sync Error State - * Timestamp - * - * @param {string} [options.parameters.syncErrorDirection] Sync Error - * Direction. Possible values include: 'none', 'initialize', 'download', - * 'upload', 'recall' - * - * @param {number} [options.parameters.itemUploadErrorCount] Item Upload Error - * Count. - * - * @param {number} [options.parameters.itemDownloadErrorCount] Item download - * error count. - * - * @param {string} [options.parameters.syncErrorContext] sync error context. - * - * @param {string} [options.parameters.currentProgressType] current progress - * type. Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' - * - * @param {number} [options.parameters.itemProgressCount] Item Progress Count - * - * @param {number} [options.parameters.itemTotalCount] Item Total Count - * - * @param {number} [options.parameters.byteProgress] Bytes in progress - * - * @param {number} [options.parameters.totalProgress] Total progress - * - * @param {number} [options.parameters.byteTotal] Bytes total - * * @param {string} [options.parameters.serverResourceId] Server Resource Id. * * @param {string} [options.parameters.provisioningState] ServerEndpoint @@ -3047,6 +2920,11 @@ export interface ServerEndpoints { * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint * lastWorkflowId * + * @param {string} [options.parameters.lastOperationName] Resource Last + * Operation Name + * + * @param {object} [options.parameters.syncStatus] Sync Health Status + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -3086,39 +2964,6 @@ export interface ServerEndpoints { * * @param {string} [options.parameters.friendlyName] Friendly Name * - * @param {date} [options.parameters.lastSyncSuccess] Last Sync Success - * - * @param {string} [options.parameters.syncErrorState] Sync Error State - * - * @param {date} [options.parameters.syncErrorStateTimestamp] Sync Error State - * Timestamp - * - * @param {string} [options.parameters.syncErrorDirection] Sync Error - * Direction. Possible values include: 'none', 'initialize', 'download', - * 'upload', 'recall' - * - * @param {number} [options.parameters.itemUploadErrorCount] Item Upload Error - * Count. - * - * @param {number} [options.parameters.itemDownloadErrorCount] Item download - * error count. - * - * @param {string} [options.parameters.syncErrorContext] sync error context. - * - * @param {string} [options.parameters.currentProgressType] current progress - * type. Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' - * - * @param {number} [options.parameters.itemProgressCount] Item Progress Count - * - * @param {number} [options.parameters.itemTotalCount] Item Total Count - * - * @param {number} [options.parameters.byteProgress] Bytes in progress - * - * @param {number} [options.parameters.totalProgress] Total progress - * - * @param {number} [options.parameters.byteTotal] Bytes total - * * @param {string} [options.parameters.serverResourceId] Server Resource Id. * * @param {string} [options.parameters.provisioningState] ServerEndpoint @@ -3127,6 +2972,11 @@ export interface ServerEndpoints { * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint * lastWorkflowId * + * @param {string} [options.parameters.lastOperationName] Resource Last + * Operation Name + * + * @param {object} [options.parameters.syncStatus] Sync Health Status + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -3251,7 +3101,7 @@ export interface ServerEndpoints { * * @reject {Error|ServiceError} - The error object. */ - beginRecallWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginRecallActionWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Recall a serverendpoint. @@ -3292,9 +3142,9 @@ export interface ServerEndpoints { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - 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; + beginRecallAction(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginRecallAction(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, callback: ServiceCallback): void; + beginRecallAction(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** @@ -3476,6 +3326,19 @@ export interface RegisteredServers { * * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {string} [parameters.discoveryEndpointUri] Resource + * discoveryEndpointUri + * + * @param {string} [parameters.resourceLocation] Resource Location + * + * @param {string} [parameters.serviceLocation] Service Location + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -3529,6 +3392,19 @@ export interface RegisteredServers { * * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {string} [parameters.discoveryEndpointUri] Resource + * discoveryEndpointUri + * + * @param {string} [parameters.resourceLocation] Resource Location + * + * @param {string} [parameters.serviceLocation] Service Location + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -3667,6 +3543,19 @@ export interface RegisteredServers { * * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {string} [parameters.discoveryEndpointUri] Resource + * discoveryEndpointUri + * + * @param {string} [parameters.resourceLocation] Resource Location + * + * @param {string} [parameters.serviceLocation] Service Location + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -3720,6 +3609,19 @@ export interface RegisteredServers { * * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {string} [parameters.discoveryEndpointUri] Resource + * discoveryEndpointUri + * + * @param {string} [parameters.resourceLocation] Resource Location + * + * @param {string} [parameters.serviceLocation] Service Location + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the diff --git a/lib/services/storagesyncManagement/lib/operations/registeredServers.js b/lib/services/storagesyncManagement/lib/operations/registeredServers.js index 9b73405de7..70c88485da 100644 --- a/lib/services/storagesyncManagement/lib/operations/registeredServers.js +++ b/lib/services/storagesyncManagement/lib/operations/registeredServers.js @@ -385,6 +385,19 @@ function _get(resourceGroupName, storageSyncServiceName, serverId, options, call * * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {string} [parameters.discoveryEndpointUri] Resource + * discoveryEndpointUri + * + * @param {string} [parameters.resourceLocation] Resource Location + * + * @param {string} [parameters.serviceLocation] Service Location + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -562,6 +575,19 @@ function _deleteMethod(resourceGroupName, storageSyncServiceName, serverId, opti * * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {string} [parameters.discoveryEndpointUri] Resource + * discoveryEndpointUri + * + * @param {string} [parameters.resourceLocation] Resource Location + * + * @param {string} [parameters.serviceLocation] Service Location + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1126,6 +1152,19 @@ class RegisteredServers { * * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {string} [parameters.discoveryEndpointUri] Resource + * discoveryEndpointUri + * + * @param {string} [parameters.resourceLocation] Resource Location + * + * @param {string} [parameters.serviceLocation] Service Location + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1191,6 +1230,19 @@ class RegisteredServers { * * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {string} [parameters.discoveryEndpointUri] Resource + * discoveryEndpointUri + * + * @param {string} [parameters.resourceLocation] Resource Location + * + * @param {string} [parameters.serviceLocation] Service Location + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1371,6 +1423,19 @@ class RegisteredServers { * * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {string} [parameters.discoveryEndpointUri] Resource + * discoveryEndpointUri + * + * @param {string} [parameters.resourceLocation] Resource Location + * + * @param {string} [parameters.serviceLocation] Service Location + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1436,6 +1501,19 @@ class RegisteredServers { * * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {string} [parameters.discoveryEndpointUri] Resource + * discoveryEndpointUri + * + * @param {string} [parameters.resourceLocation] Resource Location + * + * @param {string} [parameters.serviceLocation] Service Location + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the diff --git a/lib/services/storagesyncManagement/lib/operations/serverEndpoints.js b/lib/services/storagesyncManagement/lib/operations/serverEndpoints.js index 1798ad59c2..020e7a6d1c 100644 --- a/lib/services/storagesyncManagement/lib/operations/serverEndpoints.js +++ b/lib/services/storagesyncManagement/lib/operations/serverEndpoints.js @@ -40,38 +40,6 @@ const WebResource = msRest.WebResource; * * @param {string} [parameters.friendlyName] Friendly Name * - * @param {date} [parameters.lastSyncSuccess] Last Sync Success - * - * @param {string} [parameters.syncErrorState] Sync Error State - * - * @param {date} [parameters.syncErrorStateTimestamp] Sync Error State - * Timestamp - * - * @param {string} [parameters.syncErrorDirection] Sync Error Direction. - * Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' - * - * @param {number} [parameters.itemUploadErrorCount] Item Upload Error Count. - * - * @param {number} [parameters.itemDownloadErrorCount] Item download error - * count. - * - * @param {string} [parameters.syncErrorContext] sync error context. - * - * @param {string} [parameters.currentProgressType] current progress type. - * Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' - * - * @param {number} [parameters.itemProgressCount] Item Progress Count - * - * @param {number} [parameters.itemTotalCount] Item Total Count - * - * @param {number} [parameters.byteProgress] Bytes in progress - * - * @param {number} [parameters.totalProgress] Total progress - * - * @param {number} [parameters.byteTotal] Bytes total - * * @param {string} [parameters.serverResourceId] Server Resource Id. * * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning @@ -79,6 +47,10 @@ const WebResource = msRest.WebResource; * * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {object} [parameters.syncStatus] Sync Health Status + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -178,39 +150,6 @@ function _create(resourceGroupName, storageSyncServiceName, syncGroupName, serve * * @param {string} [options.parameters.friendlyName] Friendly Name * - * @param {date} [options.parameters.lastSyncSuccess] Last Sync Success - * - * @param {string} [options.parameters.syncErrorState] Sync Error State - * - * @param {date} [options.parameters.syncErrorStateTimestamp] Sync Error State - * Timestamp - * - * @param {string} [options.parameters.syncErrorDirection] Sync Error - * Direction. Possible values include: 'none', 'initialize', 'download', - * 'upload', 'recall' - * - * @param {number} [options.parameters.itemUploadErrorCount] Item Upload Error - * Count. - * - * @param {number} [options.parameters.itemDownloadErrorCount] Item download - * error count. - * - * @param {string} [options.parameters.syncErrorContext] sync error context. - * - * @param {string} [options.parameters.currentProgressType] current progress - * type. Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' - * - * @param {number} [options.parameters.itemProgressCount] Item Progress Count - * - * @param {number} [options.parameters.itemTotalCount] Item Total Count - * - * @param {number} [options.parameters.byteProgress] Bytes in progress - * - * @param {number} [options.parameters.totalProgress] Total progress - * - * @param {number} [options.parameters.byteTotal] Bytes total - * * @param {string} [options.parameters.serverResourceId] Server Resource Id. * * @param {string} [options.parameters.provisioningState] ServerEndpoint @@ -219,6 +158,11 @@ function _create(resourceGroupName, storageSyncServiceName, syncGroupName, serve * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint * lastWorkflowId * + * @param {string} [options.parameters.lastOperationName] Resource Last + * Operation Name + * + * @param {object} [options.parameters.syncStatus] Sync Health Status + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -729,7 +673,7 @@ function _listBySyncGroup(resourceGroupName, storageSyncServiceName, syncGroupNa * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _recall(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, callback) { +function _recallAction(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -742,7 +686,7 @@ function _recall(resourceGroupName, storageSyncServiceName, syncGroupName, serve } // Send request - this.beginRecall(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, parsedResult, httpRequest, response) => { + this.beginRecallAction(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, parsedResult, httpRequest, response) => { if (err) return callback(err); let initialResult = new msRest.HttpOperationResponse(); @@ -792,38 +736,6 @@ function _recall(resourceGroupName, storageSyncServiceName, syncGroupName, serve * * @param {string} [parameters.friendlyName] Friendly Name * - * @param {date} [parameters.lastSyncSuccess] Last Sync Success - * - * @param {string} [parameters.syncErrorState] Sync Error State - * - * @param {date} [parameters.syncErrorStateTimestamp] Sync Error State - * Timestamp - * - * @param {string} [parameters.syncErrorDirection] Sync Error Direction. - * Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' - * - * @param {number} [parameters.itemUploadErrorCount] Item Upload Error Count. - * - * @param {number} [parameters.itemDownloadErrorCount] Item download error - * count. - * - * @param {string} [parameters.syncErrorContext] sync error context. - * - * @param {string} [parameters.currentProgressType] current progress type. - * Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' - * - * @param {number} [parameters.itemProgressCount] Item Progress Count - * - * @param {number} [parameters.itemTotalCount] Item Total Count - * - * @param {number} [parameters.byteProgress] Bytes in progress - * - * @param {number} [parameters.totalProgress] Total progress - * - * @param {number} [parameters.byteTotal] Bytes total - * * @param {string} [parameters.serverResourceId] Server Resource Id. * * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning @@ -831,6 +743,10 @@ function _recall(resourceGroupName, storageSyncServiceName, syncGroupName, serve * * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {object} [parameters.syncStatus] Sync Health Status + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1037,39 +953,6 @@ function _beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, * * @param {string} [options.parameters.friendlyName] Friendly Name * - * @param {date} [options.parameters.lastSyncSuccess] Last Sync Success - * - * @param {string} [options.parameters.syncErrorState] Sync Error State - * - * @param {date} [options.parameters.syncErrorStateTimestamp] Sync Error State - * Timestamp - * - * @param {string} [options.parameters.syncErrorDirection] Sync Error - * Direction. Possible values include: 'none', 'initialize', 'download', - * 'upload', 'recall' - * - * @param {number} [options.parameters.itemUploadErrorCount] Item Upload Error - * Count. - * - * @param {number} [options.parameters.itemDownloadErrorCount] Item download - * error count. - * - * @param {string} [options.parameters.syncErrorContext] sync error context. - * - * @param {string} [options.parameters.currentProgressType] current progress - * type. Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' - * - * @param {number} [options.parameters.itemProgressCount] Item Progress Count - * - * @param {number} [options.parameters.itemTotalCount] Item Total Count - * - * @param {number} [options.parameters.byteProgress] Bytes in progress - * - * @param {number} [options.parameters.totalProgress] Total progress - * - * @param {number} [options.parameters.byteTotal] Bytes total - * * @param {string} [options.parameters.serverResourceId] Server Resource Id. * * @param {string} [options.parameters.provisioningState] ServerEndpoint @@ -1078,6 +961,11 @@ function _beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint * lastWorkflowId * + * @param {string} [options.parameters.lastOperationName] Resource Last + * Operation Name + * + * @param {object} [options.parameters.syncStatus] Sync Health Status + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -1438,7 +1326,7 @@ function _beginDeleteMethod(resourceGroupName, storageSyncServiceName, syncGroup * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _beginRecall(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, callback) { +function _beginRecallAction(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -1577,11 +1465,11 @@ class ServerEndpoints { this._get = _get; this._deleteMethod = _deleteMethod; this._listBySyncGroup = _listBySyncGroup; - this._recall = _recall; + this._recallAction = _recallAction; this._beginCreate = _beginCreate; this._beginUpdate = _beginUpdate; this._beginDeleteMethod = _beginDeleteMethod; - this._beginRecall = _beginRecall; + this._beginRecallAction = _beginRecallAction; } /** @@ -1609,38 +1497,6 @@ class ServerEndpoints { * * @param {string} [parameters.friendlyName] Friendly Name * - * @param {date} [parameters.lastSyncSuccess] Last Sync Success - * - * @param {string} [parameters.syncErrorState] Sync Error State - * - * @param {date} [parameters.syncErrorStateTimestamp] Sync Error State - * Timestamp - * - * @param {string} [parameters.syncErrorDirection] Sync Error Direction. - * Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' - * - * @param {number} [parameters.itemUploadErrorCount] Item Upload Error Count. - * - * @param {number} [parameters.itemDownloadErrorCount] Item download error - * count. - * - * @param {string} [parameters.syncErrorContext] sync error context. - * - * @param {string} [parameters.currentProgressType] current progress type. - * Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' - * - * @param {number} [parameters.itemProgressCount] Item Progress Count - * - * @param {number} [parameters.itemTotalCount] Item Total Count - * - * @param {number} [parameters.byteProgress] Bytes in progress - * - * @param {number} [parameters.totalProgress] Total progress - * - * @param {number} [parameters.byteTotal] Bytes total - * * @param {string} [parameters.serverResourceId] Server Resource Id. * * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning @@ -1648,6 +1504,10 @@ class ServerEndpoints { * * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {object} [parameters.syncStatus] Sync Health Status + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1698,38 +1558,6 @@ class ServerEndpoints { * * @param {string} [parameters.friendlyName] Friendly Name * - * @param {date} [parameters.lastSyncSuccess] Last Sync Success - * - * @param {string} [parameters.syncErrorState] Sync Error State - * - * @param {date} [parameters.syncErrorStateTimestamp] Sync Error State - * Timestamp - * - * @param {string} [parameters.syncErrorDirection] Sync Error Direction. - * Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' - * - * @param {number} [parameters.itemUploadErrorCount] Item Upload Error Count. - * - * @param {number} [parameters.itemDownloadErrorCount] Item download error - * count. - * - * @param {string} [parameters.syncErrorContext] sync error context. - * - * @param {string} [parameters.currentProgressType] current progress type. - * Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' - * - * @param {number} [parameters.itemProgressCount] Item Progress Count - * - * @param {number} [parameters.itemTotalCount] Item Total Count - * - * @param {number} [parameters.byteProgress] Bytes in progress - * - * @param {number} [parameters.totalProgress] Total progress - * - * @param {number} [parameters.byteTotal] Bytes total - * * @param {string} [parameters.serverResourceId] Server Resource Id. * * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning @@ -1737,6 +1565,10 @@ class ServerEndpoints { * * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {object} [parameters.syncStatus] Sync Health Status + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1812,39 +1644,6 @@ class ServerEndpoints { * * @param {string} [options.parameters.friendlyName] Friendly Name * - * @param {date} [options.parameters.lastSyncSuccess] Last Sync Success - * - * @param {string} [options.parameters.syncErrorState] Sync Error State - * - * @param {date} [options.parameters.syncErrorStateTimestamp] Sync Error State - * Timestamp - * - * @param {string} [options.parameters.syncErrorDirection] Sync Error - * Direction. Possible values include: 'none', 'initialize', 'download', - * 'upload', 'recall' - * - * @param {number} [options.parameters.itemUploadErrorCount] Item Upload Error - * Count. - * - * @param {number} [options.parameters.itemDownloadErrorCount] Item download - * error count. - * - * @param {string} [options.parameters.syncErrorContext] sync error context. - * - * @param {string} [options.parameters.currentProgressType] current progress - * type. Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' - * - * @param {number} [options.parameters.itemProgressCount] Item Progress Count - * - * @param {number} [options.parameters.itemTotalCount] Item Total Count - * - * @param {number} [options.parameters.byteProgress] Bytes in progress - * - * @param {number} [options.parameters.totalProgress] Total progress - * - * @param {number} [options.parameters.byteTotal] Bytes total - * * @param {string} [options.parameters.serverResourceId] Server Resource Id. * * @param {string} [options.parameters.provisioningState] ServerEndpoint @@ -1853,6 +1652,11 @@ class ServerEndpoints { * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint * lastWorkflowId * + * @param {string} [options.parameters.lastOperationName] Resource Last + * Operation Name + * + * @param {object} [options.parameters.syncStatus] Sync Health Status + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -1904,39 +1708,6 @@ class ServerEndpoints { * * @param {string} [options.parameters.friendlyName] Friendly Name * - * @param {date} [options.parameters.lastSyncSuccess] Last Sync Success - * - * @param {string} [options.parameters.syncErrorState] Sync Error State - * - * @param {date} [options.parameters.syncErrorStateTimestamp] Sync Error State - * Timestamp - * - * @param {string} [options.parameters.syncErrorDirection] Sync Error - * Direction. Possible values include: 'none', 'initialize', 'download', - * 'upload', 'recall' - * - * @param {number} [options.parameters.itemUploadErrorCount] Item Upload Error - * Count. - * - * @param {number} [options.parameters.itemDownloadErrorCount] Item download - * error count. - * - * @param {string} [options.parameters.syncErrorContext] sync error context. - * - * @param {string} [options.parameters.currentProgressType] current progress - * type. Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' - * - * @param {number} [options.parameters.itemProgressCount] Item Progress Count - * - * @param {number} [options.parameters.itemTotalCount] Item Total Count - * - * @param {number} [options.parameters.byteProgress] Bytes in progress - * - * @param {number} [options.parameters.totalProgress] Total progress - * - * @param {number} [options.parameters.byteTotal] Bytes total - * * @param {string} [options.parameters.serverResourceId] Server Resource Id. * * @param {string} [options.parameters.provisioningState] ServerEndpoint @@ -1945,6 +1716,11 @@ class ServerEndpoints { * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint * lastWorkflowId * + * @param {string} [options.parameters.lastOperationName] Resource Last + * Operation Name + * + * @param {object} [options.parameters.syncStatus] Sync Health Status + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -2303,11 +2079,11 @@ class ServerEndpoints { * * @reject {Error} - The error object. */ - recallWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options) { + recallActionWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._recall(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { + self._recallAction(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -2356,7 +2132,7 @@ class ServerEndpoints { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - recall(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, optionalCallback) { + recallAction(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -2365,14 +2141,14 @@ class ServerEndpoints { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._recall(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { + self._recallAction(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._recall(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, optionalCallback); + return self._recallAction(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, optionalCallback); } } @@ -2401,38 +2177,6 @@ class ServerEndpoints { * * @param {string} [parameters.friendlyName] Friendly Name * - * @param {date} [parameters.lastSyncSuccess] Last Sync Success - * - * @param {string} [parameters.syncErrorState] Sync Error State - * - * @param {date} [parameters.syncErrorStateTimestamp] Sync Error State - * Timestamp - * - * @param {string} [parameters.syncErrorDirection] Sync Error Direction. - * Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' - * - * @param {number} [parameters.itemUploadErrorCount] Item Upload Error Count. - * - * @param {number} [parameters.itemDownloadErrorCount] Item download error - * count. - * - * @param {string} [parameters.syncErrorContext] sync error context. - * - * @param {string} [parameters.currentProgressType] current progress type. - * Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' - * - * @param {number} [parameters.itemProgressCount] Item Progress Count - * - * @param {number} [parameters.itemTotalCount] Item Total Count - * - * @param {number} [parameters.byteProgress] Bytes in progress - * - * @param {number} [parameters.totalProgress] Total progress - * - * @param {number} [parameters.byteTotal] Bytes total - * * @param {string} [parameters.serverResourceId] Server Resource Id. * * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning @@ -2440,6 +2184,10 @@ class ServerEndpoints { * * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {object} [parameters.syncStatus] Sync Health Status + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -2490,38 +2238,6 @@ class ServerEndpoints { * * @param {string} [parameters.friendlyName] Friendly Name * - * @param {date} [parameters.lastSyncSuccess] Last Sync Success - * - * @param {string} [parameters.syncErrorState] Sync Error State - * - * @param {date} [parameters.syncErrorStateTimestamp] Sync Error State - * Timestamp - * - * @param {string} [parameters.syncErrorDirection] Sync Error Direction. - * Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' - * - * @param {number} [parameters.itemUploadErrorCount] Item Upload Error Count. - * - * @param {number} [parameters.itemDownloadErrorCount] Item download error - * count. - * - * @param {string} [parameters.syncErrorContext] sync error context. - * - * @param {string} [parameters.currentProgressType] current progress type. - * Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' - * - * @param {number} [parameters.itemProgressCount] Item Progress Count - * - * @param {number} [parameters.itemTotalCount] Item Total Count - * - * @param {number} [parameters.byteProgress] Bytes in progress - * - * @param {number} [parameters.totalProgress] Total progress - * - * @param {number} [parameters.byteTotal] Bytes total - * * @param {string} [parameters.serverResourceId] Server Resource Id. * * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning @@ -2529,6 +2245,10 @@ class ServerEndpoints { * * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {object} [parameters.syncStatus] Sync Health Status + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -2604,39 +2324,6 @@ class ServerEndpoints { * * @param {string} [options.parameters.friendlyName] Friendly Name * - * @param {date} [options.parameters.lastSyncSuccess] Last Sync Success - * - * @param {string} [options.parameters.syncErrorState] Sync Error State - * - * @param {date} [options.parameters.syncErrorStateTimestamp] Sync Error State - * Timestamp - * - * @param {string} [options.parameters.syncErrorDirection] Sync Error - * Direction. Possible values include: 'none', 'initialize', 'download', - * 'upload', 'recall' - * - * @param {number} [options.parameters.itemUploadErrorCount] Item Upload Error - * Count. - * - * @param {number} [options.parameters.itemDownloadErrorCount] Item download - * error count. - * - * @param {string} [options.parameters.syncErrorContext] sync error context. - * - * @param {string} [options.parameters.currentProgressType] current progress - * type. Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' - * - * @param {number} [options.parameters.itemProgressCount] Item Progress Count - * - * @param {number} [options.parameters.itemTotalCount] Item Total Count - * - * @param {number} [options.parameters.byteProgress] Bytes in progress - * - * @param {number} [options.parameters.totalProgress] Total progress - * - * @param {number} [options.parameters.byteTotal] Bytes total - * * @param {string} [options.parameters.serverResourceId] Server Resource Id. * * @param {string} [options.parameters.provisioningState] ServerEndpoint @@ -2645,6 +2332,11 @@ class ServerEndpoints { * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint * lastWorkflowId * + * @param {string} [options.parameters.lastOperationName] Resource Last + * Operation Name + * + * @param {object} [options.parameters.syncStatus] Sync Health Status + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -2696,39 +2388,6 @@ class ServerEndpoints { * * @param {string} [options.parameters.friendlyName] Friendly Name * - * @param {date} [options.parameters.lastSyncSuccess] Last Sync Success - * - * @param {string} [options.parameters.syncErrorState] Sync Error State - * - * @param {date} [options.parameters.syncErrorStateTimestamp] Sync Error State - * Timestamp - * - * @param {string} [options.parameters.syncErrorDirection] Sync Error - * Direction. Possible values include: 'none', 'initialize', 'download', - * 'upload', 'recall' - * - * @param {number} [options.parameters.itemUploadErrorCount] Item Upload Error - * Count. - * - * @param {number} [options.parameters.itemDownloadErrorCount] Item download - * error count. - * - * @param {string} [options.parameters.syncErrorContext] sync error context. - * - * @param {string} [options.parameters.currentProgressType] current progress - * type. Possible values include: 'none', 'initialize', 'download', 'upload', - * 'recall' - * - * @param {number} [options.parameters.itemProgressCount] Item Progress Count - * - * @param {number} [options.parameters.itemTotalCount] Item Total Count - * - * @param {number} [options.parameters.byteProgress] Bytes in progress - * - * @param {number} [options.parameters.totalProgress] Total progress - * - * @param {number} [options.parameters.byteTotal] Bytes total - * * @param {string} [options.parameters.serverResourceId] Server Resource Id. * * @param {string} [options.parameters.provisioningState] ServerEndpoint @@ -2737,6 +2396,11 @@ class ServerEndpoints { * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint * lastWorkflowId * + * @param {string} [options.parameters.lastOperationName] Resource Last + * Operation Name + * + * @param {object} [options.parameters.syncStatus] Sync Health Status + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -2903,11 +2567,11 @@ class ServerEndpoints { * * @reject {Error} - The error object. */ - beginRecallWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options) { + beginRecallActionWithHttpOperationResponse(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) => { + self._beginRecallAction(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -2956,7 +2620,7 @@ class ServerEndpoints { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - beginRecall(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, optionalCallback) { + beginRecallAction(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -2965,14 +2629,14 @@ class ServerEndpoints { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._beginRecall(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { + self._beginRecallAction(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); + return self._beginRecallAction(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, optionalCallback); } } diff --git a/lib/services/storagesyncManagement/lib/operations/storageSyncServices.js b/lib/services/storagesyncManagement/lib/operations/storageSyncServices.js index d1bbc819bb..3dffc26791 100644 --- a/lib/services/storagesyncManagement/lib/operations/storageSyncServices.js +++ b/lib/services/storagesyncManagement/lib/operations/storageSyncServices.js @@ -14,6 +14,172 @@ const msRest = require('ms-rest'); const msRestAzure = require('ms-rest-azure'); const WebResource = msRest.WebResource; +/** + * Check the give namespace name availability. + * + * @param {string} locationName The desired region for the name check. + * + * @param {object} parameters Parameters to check availability of the given + * namespace name + * + * @param {string} parameters.name The name to check for availability + * + * @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 CheckNameAvailabilityResult} for more + * information. + * + * {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 _checkNameAvailability(locationName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + if (parameters === null || parameters === undefined) + { + parameters = {}; + } + // Validate + try { + if (locationName === null || locationName === undefined || typeof locationName.valueOf() !== 'string') { + throw new Error('locationName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/locations/{locationName}/checkNameAvailability'; + requestUrl = requestUrl.replace('{locationName}', encodeURIComponent(locationName)); + 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 = '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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['CheckNameAvailabilityParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['CheckNameAvailabilityResult']().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 StorageSyncService. * @@ -979,6 +1145,7 @@ class StorageSyncServices { */ constructor(client) { this.client = client; + this._checkNameAvailability = _checkNameAvailability; this._create = _create; this._get = _get; this._update = _update; @@ -987,6 +1154,99 @@ class StorageSyncServices { this._listBySubscription = _listBySubscription; } + /** + * Check the give namespace name availability. + * + * @param {string} locationName The desired region for the name check. + * + * @param {object} parameters Parameters to check availability of the given + * namespace name + * + * @param {string} parameters.name The name to check for availability + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + checkNameAvailabilityWithHttpOperationResponse(locationName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._checkNameAvailability(locationName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Check the give namespace name availability. + * + * @param {string} locationName The desired region for the name check. + * + * @param {object} parameters Parameters to check availability of the given + * namespace name + * + * @param {string} parameters.name The name to check for availability + * + * @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 {CheckNameAvailabilityResult} - 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 CheckNameAvailabilityResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + checkNameAvailability(locationName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._checkNameAvailability(locationName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._checkNameAvailability(locationName, parameters, options, optionalCallback); + } + } + /** * Create a new StorageSyncService. * diff --git a/lib/services/storagesyncManagement/lib/storageSyncManagementClient.d.ts b/lib/services/storagesyncManagement/lib/storageSyncManagementClient.d.ts index 89f26b45c2..27ea21fd0f 100644 --- a/lib/services/storagesyncManagement/lib/storageSyncManagementClient.d.ts +++ b/lib/services/storagesyncManagement/lib/storageSyncManagementClient.d.ts @@ -34,11 +34,11 @@ export default class StorageSyncManagementClient extends AzureServiceClient { * * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy * - * @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response. + * @param {string} [options.acceptLanguage] - The preferred language for the response. * - * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. * - * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. * */ constructor(credentials: ServiceClientCredentials, subscriptionId: string, baseUri?: string, options?: AzureServiceClientOptions); diff --git a/lib/services/storagesyncManagement/lib/storageSyncManagementClient.js b/lib/services/storagesyncManagement/lib/storageSyncManagementClient.js index 43d148eb6e..2216907265 100644 --- a/lib/services/storagesyncManagement/lib/storageSyncManagementClient.js +++ b/lib/services/storagesyncManagement/lib/storageSyncManagementClient.js @@ -34,9 +34,9 @@ class StorageSyncManagementClient extends ServiceClient { * @param {object} [options.requestOptions] - Options for the underlying request object * {@link https://github.com/request/request#requestoptions-callback Options doc} * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy - * @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response. - * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. - * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * @param {string} [options.acceptLanguage] - The preferred language for the response. + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. + * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ constructor(credentials, subscriptionId, baseUri, options) { if (credentials === null || credentials === undefined) { @@ -50,7 +50,7 @@ class StorageSyncManagementClient extends ServiceClient { super(credentials, options); - this.apiVersion = '2017-06-05-preview'; + this.apiVersion = '2018-04-02'; this.acceptLanguage = 'en-US'; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; diff --git a/lib/services/storagesyncManagement/package.json b/lib/services/storagesyncManagement/package.json index c158f40b5e..22c93d1e4d 100644 --- a/lib/services/storagesyncManagement/package.json +++ b/lib/services/storagesyncManagement/package.json @@ -14,12 +14,12 @@ "license": "MIT", "main": "./lib/storageSyncManagementClient.js", "types": "./lib/storageSyncManagementClient.d.ts", - "homepage": "http://github.com/azure/azure-sdk-for-node", + "homepage": "https://github.com/azure/azure-sdk-for-node/tree/master/lib/services/storagesyncManagement", "repository": { "type": "git", "url": "https://github.com/azure/azure-sdk-for-node.git" }, "bugs": { - "url": "http://github.com/Azure/azure-sdk-for-node/issues" + "url": "https://github.com/azure/azure-sdk-for-node/issues" } } diff --git a/lib/services/storagesyncmanagement/README.md b/lib/services/storagesyncmanagement/README.md index d48092678a..266b0589d5 100644 --- a/lib/services/storagesyncmanagement/README.md +++ b/lib/services/storagesyncmanagement/README.md @@ -1,5 +1,5 @@ --- -uid: azure-arm-storagesyncmanagement +uid: azure-arm-storagesync summary: *content --- @@ -13,7 +13,7 @@ This project provides a Node.js package for accessing Azure. Right now it suppor ## How to Install ```bash -npm install azure-arm-storagesyncmanagement +npm install azure-arm-storagesync ``` ## How to use @@ -22,7 +22,7 @@ npm install azure-arm-storagesyncmanagement ```javascript const msRestAzure = require("ms-rest-azure"); -const StorageSyncManagementClient = require("azure-arm-storagesyncmanagement"); +const StorageSyncManagementClient = require("azure-arm-storagesync"); msRestAzure.interactiveLogin().then((creds) => { const subscriptionId = ""; const client = new StorageSyncManagementClient(creds, subscriptionId); 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/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/operationEntity.js b/lib/services/storagesyncmanagement/lib/models/operationEntity.js index 8d29602603..e7a1b503f7 100644 --- a/lib/services/storagesyncmanagement/lib/models/operationEntity.js +++ b/lib/services/storagesyncmanagement/lib/models/operationEntity.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The operation supported by storage sync. * diff --git a/lib/services/storagesyncmanagement/lib/models/postRestoreRequest.js b/lib/services/storagesyncmanagement/lib/models/postRestoreRequest.js index 82450187a5..32be654193 100644 --- a/lib/services/storagesyncmanagement/lib/models/postRestoreRequest.js +++ b/lib/services/storagesyncmanagement/lib/models/postRestoreRequest.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * Post Restore Request * diff --git a/lib/services/storagesyncmanagement/lib/models/preRestoreRequest.js b/lib/services/storagesyncmanagement/lib/models/preRestoreRequest.js index 3afda3c8b9..47c2c0e206 100644 --- a/lib/services/storagesyncmanagement/lib/models/preRestoreRequest.js +++ b/lib/services/storagesyncmanagement/lib/models/preRestoreRequest.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * Pre Restore request object. * diff --git a/lib/services/storagesyncmanagement/lib/models/storageSyncError.js b/lib/services/storagesyncmanagement/lib/models/storageSyncError.js index 509d940f23..b185128307 100644 --- a/lib/services/storagesyncmanagement/lib/models/storageSyncError.js +++ b/lib/services/storagesyncmanagement/lib/models/storageSyncError.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * Error type * diff --git a/lib/services/storagesyncmanagement/lib/models/workflowArray.js b/lib/services/storagesyncmanagement/lib/models/workflowArray.js index 698149ba59..c2c3eb737f 100644 --- a/lib/services/storagesyncmanagement/lib/models/workflowArray.js +++ b/lib/services/storagesyncmanagement/lib/models/workflowArray.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * Array of Workflow * 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/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/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/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/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/storageSyncManagementClient.d.ts b/lib/services/storagesyncmanagement/lib/storageSyncManagementClient.d.ts index 89f26b45c2..27ea21fd0f 100644 --- a/lib/services/storagesyncmanagement/lib/storageSyncManagementClient.d.ts +++ b/lib/services/storagesyncmanagement/lib/storageSyncManagementClient.d.ts @@ -34,11 +34,11 @@ export default class StorageSyncManagementClient extends AzureServiceClient { * * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy * - * @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response. + * @param {string} [options.acceptLanguage] - The preferred language for the response. * - * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. * - * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. * */ constructor(credentials: ServiceClientCredentials, subscriptionId: string, baseUri?: string, options?: AzureServiceClientOptions); diff --git a/lib/services/storagesyncmanagement/lib/storageSyncManagementClient.js b/lib/services/storagesyncmanagement/lib/storageSyncManagementClient.js index d2c20ef7ba..2216907265 100644 --- a/lib/services/storagesyncmanagement/lib/storageSyncManagementClient.js +++ b/lib/services/storagesyncmanagement/lib/storageSyncManagementClient.js @@ -34,9 +34,9 @@ class StorageSyncManagementClient extends ServiceClient { * @param {object} [options.requestOptions] - Options for the underlying request object * {@link https://github.com/request/request#requestoptions-callback Options doc} * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy - * @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response. - * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. - * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * @param {string} [options.acceptLanguage] - The preferred language for the response. + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. + * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ constructor(credentials, subscriptionId, baseUri, options) { if (credentials === null || credentials === undefined) { diff --git a/lib/services/storagesyncmanagement/package-lock.json b/lib/services/storagesyncmanagement/package-lock.json new file mode 100644 index 0000000000..967c66460d --- /dev/null +++ b/lib/services/storagesyncmanagement/package-lock.json @@ -0,0 +1,483 @@ +{ + "name": "azure-arm-storagesync", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@types/node": { + "version": "8.10.26", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.26.tgz", + "integrity": "sha512-opk6bLLErLSwyVVJeSH5Ek7ZWOBSsN0JrvXTNVGLXLAXKB9xlTYajrplR44xVyMrmbut94H6uJ9jqzM/12jxkA==" + }, + "adal-node": { + "version": "0.1.28", + "resolved": "https://registry.npmjs.org/adal-node/-/adal-node-0.1.28.tgz", + "integrity": "sha1-RoxLs+u9lrEnBmn0ucuk4AZepIU=", + "requires": { + "@types/node": "^8.0.47", + "async": ">=0.6.0", + "date-utils": "*", + "jws": "3.x.x", + "request": ">= 2.52.0", + "underscore": ">= 1.3.1", + "uuid": "^3.1.0", + "xmldom": ">= 0.1.x", + "xpath.js": "~1.1.0" + } + }, + "ajv": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "requires": { + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" + } + }, + "asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "async": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz", + "integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==", + "requires": { + "lodash": "^4.14.0" + } + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "optional": true, + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=" + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + }, + "combined-stream": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", + "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "date-utils": { + "version": "1.2.21", + "resolved": "https://registry.npmjs.org/date-utils/-/date-utils-1.2.21.tgz", + "integrity": "sha1-YfsWzcEnSzyayq/+n8ad+HIKK2Q=" + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "duplexer": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", + "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=" + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "optional": true, + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "ecdsa-sig-formatter": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.10.tgz", + "integrity": "sha1-HFlQAPBKiJffuFAAiSoPTDOvhsM=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-deep-equal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", + "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "1.0.6", + "mime-types": "^2.1.12" + } + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", + "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", + "requires": { + "ajv": "^5.3.0", + "har-schema": "^2.0.0" + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "optional": true + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "jwa": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.1.6.tgz", + "integrity": "sha512-tBO/cf++BUsJkYql/kBbJroKOgHWEigTKBAjjBEmrMGYd1QMBC74Hr4Wo2zCZw6ZrVhlJPvoMrkcOnlWR/DJfw==", + "requires": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.10", + "safe-buffer": "^5.0.1" + } + }, + "jws": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.1.5.tgz", + "integrity": "sha512-GsCSexFADNQUr8T5HPJvayTjvPIfoyJPtLQBwn5a4WZQchcrPMPMAWcC1AzJVRDKyD6ZPROPAxgv6rfHViO4uQ==", + "requires": { + "jwa": "^1.1.5", + "safe-buffer": "^5.0.1" + } + }, + "lodash": { + "version": "4.17.10", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", + "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==" + }, + "mime-db": { + "version": "1.35.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.35.0.tgz", + "integrity": "sha512-JWT/IcCTsB0Io3AhWUMjRqucrHSPsSf2xKLaRldJVULioggvkJvggZ3VXNNSRkCddE6D+BUI4HEIZIA2OjwIvg==" + }, + "mime-types": { + "version": "2.1.19", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.19.tgz", + "integrity": "sha512-P1tKYHVSZ6uFo26mtnve4HQFE3koh1UWVkp8YUC+ESBHe945xWSoXuHHiGarDqcEZ+whpCDnlNw5LON0kLo+sw==", + "requires": { + "mime-db": "~1.35.0" + } + }, + "moment": { + "version": "2.22.2", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.22.2.tgz", + "integrity": "sha1-PCV/mDn8DpP/UxSWMiOeuQeD/2Y=" + }, + "ms-rest": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/ms-rest/-/ms-rest-2.3.6.tgz", + "integrity": "sha512-M+Lx9P7Wy4TeAk7jqPLwGS1QS1gvxF6Xo+OHv5j1g3Kcb44T/GTUuSjxTKarF6aKyeacZH1ZD++Nt7pcql7dDA==", + "requires": { + "duplexer": "^0.1.1", + "is-buffer": "^1.1.6", + "is-stream": "^1.1.0", + "moment": "^2.21.0", + "request": "^2.87.0", + "through": "^2.3.8", + "tunnel": "0.0.5", + "uuid": "^3.2.1" + } + }, + "ms-rest-azure": { + "version": "2.5.7", + "resolved": "https://registry.npmjs.org/ms-rest-azure/-/ms-rest-azure-2.5.7.tgz", + "integrity": "sha512-e4lgB0z29Dx4ufu/c+PmEAYY1WXq98GYUBkE+iRx7WsxsN04lrM3B1vj8y+B8rKt7clPUE0niqB9VovVL8zvag==", + "requires": { + "adal-node": "^0.1.28", + "async": "2.6.0", + "moment": "^2.22.2", + "ms-rest": "^2.3.2", + "uuid": "^3.2.1" + } + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "psl": { + "version": "1.1.29", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", + "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==" + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + }, + "request": { + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "sshpk": { + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz", + "integrity": "sha1-xvxhZIo9nE52T9P8306hBeSSupg=", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" + }, + "tough-cookie": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + } + }, + "tunnel": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.5.tgz", + "integrity": "sha512-gj5sdqherx4VZKMcBA4vewER7zdK25Td+z1npBqpbDys4eJrLx+SlYjJvq1bDXs2irkuJM5pf8ktaEQVipkrbA==" + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "optional": true + }, + "underscore": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", + "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==" + }, + "uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "xmldom": { + "version": "0.1.27", + "resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.1.27.tgz", + "integrity": "sha1-1QH5ezvbQDr4757MIFcxh6rawOk=" + }, + "xpath.js": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xpath.js/-/xpath.js-1.1.0.tgz", + "integrity": "sha512-jg+qkfS4K8E7965sqaUl8mRngXiKb3WZGfONgE18pr03FUQiuSV6G+Ej4tS55B+rIQSFEIw3phdVAQ4pPqNWfQ==" + } + } +} diff --git a/lib/services/storagesyncmanagement/package.json b/lib/services/storagesyncmanagement/package.json index 549ae20014..22c93d1e4d 100644 --- a/lib/services/storagesyncmanagement/package.json +++ b/lib/services/storagesyncmanagement/package.json @@ -1,8 +1,8 @@ { - "name": "azure-arm-storagesyncmanagement", + "name": "azure-arm-storagesync", "author": "Microsoft Corporation", "description": "StorageSyncManagementClient Library with typescript type definitions for node", - "version": "1.1.0", + "version": "1.0.0", "dependencies": { "ms-rest": "^2.3.3", "ms-rest-azure": "^2.5.5" @@ -14,12 +14,12 @@ "license": "MIT", "main": "./lib/storageSyncManagementClient.js", "types": "./lib/storageSyncManagementClient.d.ts", - "homepage": "http://github.com/azure/azure-sdk-for-node", + "homepage": "https://github.com/azure/azure-sdk-for-node/tree/master/lib/services/storagesyncManagement", "repository": { "type": "git", "url": "https://github.com/azure/azure-sdk-for-node.git" }, "bugs": { - "url": "http://github.com/Azure/azure-sdk-for-node/issues" + "url": "https://github.com/azure/azure-sdk-for-node/issues" } } From 1e2bc2352f9df47acc277ff46d45cb83fa2d50fd Mon Sep 17 00:00:00 2001 From: Dan Schulte Date: Mon, 20 Aug 2018 10:41:36 -0700 Subject: [PATCH 4/5] Delete storagesyncmanagement folder --- .../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 | 137 - .../lib/models/cloudEndpointArray.js | 59 - .../lib/models/errorDetails.js | 68 - .../lib/models/errorModel.js | 74 - .../lib/models/index.d.ts | 544 --- .../storagesyncManagement/lib/models/index.js | 49 - .../lib/models/operationDisplayInfo.js | 77 - .../lib/models/operationDisplayResource.js | 76 - .../lib/models/operationEntity.js | 76 - .../lib/models/operationEntityListResult.js | 68 - .../lib/models/postBackupResponse.js | 53 - .../lib/models/postRestoreRequest.js | 117 - .../lib/models/preRestoreRequest.js | 127 - .../lib/models/registeredServer.js | 221 - .../lib/models/registeredServerArray.js | 59 - .../lib/models/resource.js | 75 - .../lib/models/resourcesMoveInfo.js | 67 - .../lib/models/restoreFileSpec.js | 61 - .../lib/models/serverEndpoint.js | 126 - .../lib/models/serverEndpointArray.js | 59 - .../lib/models/storageSyncError.js | 72 - .../lib/models/storageSyncErrorDetails.js | 68 - .../lib/models/storageSyncService.js | 66 - .../lib/models/storageSyncServiceArray.js | 59 - .../lib/models/subscriptionState.js | 70 - .../lib/models/syncGroup.js | 65 - .../lib/models/syncGroupArray.js | 59 - .../lib/models/trackedResource.js | 88 - .../lib/models/workflow.js | 90 - .../lib/models/workflowArray.js | 60 - .../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 | 3986 ----------------- .../lib/operations/cloudEndpointsGet.js | 292 -- .../lib/operations/getSyncGroups.js | 282 -- .../lib/operations/index.d.ts | 3863 ---------------- .../lib/operations/index.js | 23 - .../lib/operations/operationGet.js | 455 -- .../lib/operations/operations.js | 455 -- .../lib/operations/registeredServers.js | 1659 ------- .../lib/operations/registeredServersGet.js | 282 -- .../lib/operations/serverEndpointRecall.js | 450 -- .../lib/operations/serverEndpoints.js | 2645 ----------- .../lib/operations/serverEndpointsGet.js | 292 -- .../storageSyncServiceByResourceGroupGet.js | 271 -- .../lib/operations/storageSyncServiceGet.js | 244 - .../lib/operations/storageSyncServices.js | 1783 -------- .../lib/operations/syncGroups.js | 1081 ----- .../lib/operations/workflows.js | 536 --- .../lib/storageSyncManagementClient.d.ts | 68 - .../lib/storageSyncManagementClient.js | 91 - .../storagesyncManagement/package.json | 25 - .../storagesyncmanagement/LICENSE.txt | 21 - lib/services/storagesyncmanagement/README.md | 40 - .../lib/microsoftStorageSync.d.ts | 81 - .../lib/microsoftStorageSync.js | 104 - .../lib/models/backupRequest.js | 52 - .../models/checkNameAvailabilityParameters.js | 61 - .../lib/models/checkNameAvailabilityResult.js | 78 - .../lib/models/cloudEndpoint.js | 137 - .../lib/models/cloudEndpointArray.js | 59 - .../lib/models/errorDetails.js | 68 - .../lib/models/errorModel.js | 74 - .../lib/models/index.d.ts | 544 --- .../storagesyncmanagement/lib/models/index.js | 49 - .../lib/models/operationDisplayInfo.js | 77 - .../lib/models/operationDisplayResource.js | 76 - .../lib/models/operationEntity.js | 76 - .../lib/models/operationEntityListResult.js | 68 - .../lib/models/postBackupResponse.js | 53 - .../lib/models/postRestoreRequest.js | 117 - .../lib/models/preRestoreRequest.js | 127 - .../lib/models/registeredServer.js | 221 - .../lib/models/registeredServerArray.js | 59 - .../lib/models/resource.js | 75 - .../lib/models/resourcesMoveInfo.js | 67 - .../lib/models/restoreFileSpec.js | 61 - .../lib/models/serverEndpoint.js | 126 - .../lib/models/serverEndpointArray.js | 59 - .../lib/models/storageSyncError.js | 72 - .../lib/models/storageSyncErrorDetails.js | 68 - .../lib/models/storageSyncService.js | 66 - .../lib/models/storageSyncServiceArray.js | 59 - .../lib/models/subscriptionState.js | 70 - .../lib/models/syncGroup.js | 65 - .../lib/models/syncGroupArray.js | 59 - .../lib/models/trackedResource.js | 88 - .../lib/models/workflow.js | 90 - .../lib/models/workflowArray.js | 60 - .../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 | 3986 ----------------- .../lib/operations/cloudEndpointsGet.js | 292 -- .../lib/operations/getSyncGroups.js | 282 -- .../lib/operations/index.d.ts | 3863 ---------------- .../lib/operations/index.js | 23 - .../lib/operations/operationGet.js | 455 -- .../lib/operations/operations.js | 455 -- .../lib/operations/registeredServers.js | 1659 ------- .../lib/operations/registeredServersGet.js | 282 -- .../lib/operations/serverEndpointRecall.js | 450 -- .../lib/operations/serverEndpoints.js | 2645 ----------- .../lib/operations/serverEndpointsGet.js | 292 -- .../storageSyncServiceByResourceGroupGet.js | 271 -- .../lib/operations/storageSyncServiceGet.js | 244 - .../lib/operations/storageSyncServices.js | 1783 -------- .../lib/operations/syncGroups.js | 1081 ----- .../lib/operations/workflows.js | 536 --- .../lib/storageSyncManagementClient.d.ts | 68 - .../lib/storageSyncManagementClient.js | 91 - .../storagesyncmanagement/package-lock.json | 483 -- .../storagesyncmanagement/package.json | 25 - 125 files changed, 50082 deletions(-) delete mode 100644 lib/services/storagesyncManagement/LICENSE.txt delete mode 100644 lib/services/storagesyncManagement/README.md delete mode 100644 lib/services/storagesyncManagement/lib/microsoftStorageSync.d.ts delete mode 100644 lib/services/storagesyncManagement/lib/microsoftStorageSync.js delete mode 100644 lib/services/storagesyncManagement/lib/models/backupRequest.js delete mode 100644 lib/services/storagesyncManagement/lib/models/cloudEndpoint.js delete mode 100644 lib/services/storagesyncManagement/lib/models/cloudEndpointArray.js delete mode 100644 lib/services/storagesyncManagement/lib/models/errorDetails.js delete mode 100644 lib/services/storagesyncManagement/lib/models/errorModel.js delete mode 100644 lib/services/storagesyncManagement/lib/models/index.d.ts delete mode 100644 lib/services/storagesyncManagement/lib/models/index.js delete mode 100644 lib/services/storagesyncManagement/lib/models/operationDisplayInfo.js delete mode 100644 lib/services/storagesyncManagement/lib/models/operationDisplayResource.js delete mode 100644 lib/services/storagesyncManagement/lib/models/operationEntity.js delete mode 100644 lib/services/storagesyncManagement/lib/models/operationEntityListResult.js delete mode 100644 lib/services/storagesyncManagement/lib/models/postBackupResponse.js delete mode 100644 lib/services/storagesyncManagement/lib/models/postRestoreRequest.js delete mode 100644 lib/services/storagesyncManagement/lib/models/preRestoreRequest.js delete mode 100644 lib/services/storagesyncManagement/lib/models/registeredServer.js delete mode 100644 lib/services/storagesyncManagement/lib/models/registeredServerArray.js delete mode 100644 lib/services/storagesyncManagement/lib/models/resource.js delete mode 100644 lib/services/storagesyncManagement/lib/models/resourcesMoveInfo.js delete mode 100644 lib/services/storagesyncManagement/lib/models/restoreFileSpec.js delete mode 100644 lib/services/storagesyncManagement/lib/models/serverEndpoint.js delete mode 100644 lib/services/storagesyncManagement/lib/models/serverEndpointArray.js delete mode 100644 lib/services/storagesyncManagement/lib/models/storageSyncError.js delete mode 100644 lib/services/storagesyncManagement/lib/models/storageSyncErrorDetails.js delete mode 100644 lib/services/storagesyncManagement/lib/models/storageSyncService.js delete mode 100644 lib/services/storagesyncManagement/lib/models/storageSyncServiceArray.js delete mode 100644 lib/services/storagesyncManagement/lib/models/subscriptionState.js delete mode 100644 lib/services/storagesyncManagement/lib/models/syncGroup.js delete mode 100644 lib/services/storagesyncManagement/lib/models/syncGroupArray.js delete mode 100644 lib/services/storagesyncManagement/lib/models/trackedResource.js delete mode 100644 lib/services/storagesyncManagement/lib/models/workflow.js delete mode 100644 lib/services/storagesyncManagement/lib/models/workflowArray.js delete mode 100644 lib/services/storagesyncManagement/lib/operations/abortWorkflows.js delete mode 100644 lib/services/storagesyncManagement/lib/operations/cloudEndpointPostBackup.js delete mode 100644 lib/services/storagesyncManagement/lib/operations/cloudEndpointPostRestore.js delete mode 100644 lib/services/storagesyncManagement/lib/operations/cloudEndpointPreBackup.js delete mode 100644 lib/services/storagesyncManagement/lib/operations/cloudEndpointPreRestore.js delete mode 100644 lib/services/storagesyncManagement/lib/operations/cloudEndpointRestoreHeatbeat.js delete mode 100644 lib/services/storagesyncManagement/lib/operations/cloudEndpoints.js delete mode 100644 lib/services/storagesyncManagement/lib/operations/cloudEndpointsGet.js delete mode 100644 lib/services/storagesyncManagement/lib/operations/getSyncGroups.js delete mode 100644 lib/services/storagesyncManagement/lib/operations/index.d.ts delete mode 100644 lib/services/storagesyncManagement/lib/operations/index.js delete mode 100644 lib/services/storagesyncManagement/lib/operations/operationGet.js delete mode 100644 lib/services/storagesyncManagement/lib/operations/operations.js delete mode 100644 lib/services/storagesyncManagement/lib/operations/registeredServers.js delete mode 100644 lib/services/storagesyncManagement/lib/operations/registeredServersGet.js delete mode 100644 lib/services/storagesyncManagement/lib/operations/serverEndpointRecall.js delete mode 100644 lib/services/storagesyncManagement/lib/operations/serverEndpoints.js delete mode 100644 lib/services/storagesyncManagement/lib/operations/serverEndpointsGet.js delete mode 100644 lib/services/storagesyncManagement/lib/operations/storageSyncServiceByResourceGroupGet.js delete mode 100644 lib/services/storagesyncManagement/lib/operations/storageSyncServiceGet.js delete mode 100644 lib/services/storagesyncManagement/lib/operations/storageSyncServices.js delete mode 100644 lib/services/storagesyncManagement/lib/operations/syncGroups.js delete mode 100644 lib/services/storagesyncManagement/lib/operations/workflows.js delete mode 100644 lib/services/storagesyncManagement/lib/storageSyncManagementClient.d.ts delete mode 100644 lib/services/storagesyncManagement/lib/storageSyncManagementClient.js delete mode 100644 lib/services/storagesyncManagement/package.json delete mode 100644 lib/services/storagesyncmanagement/LICENSE.txt delete mode 100644 lib/services/storagesyncmanagement/README.md delete mode 100644 lib/services/storagesyncmanagement/lib/microsoftStorageSync.d.ts delete mode 100644 lib/services/storagesyncmanagement/lib/microsoftStorageSync.js delete mode 100644 lib/services/storagesyncmanagement/lib/models/backupRequest.js delete mode 100644 lib/services/storagesyncmanagement/lib/models/checkNameAvailabilityParameters.js delete mode 100644 lib/services/storagesyncmanagement/lib/models/checkNameAvailabilityResult.js delete mode 100644 lib/services/storagesyncmanagement/lib/models/cloudEndpoint.js delete mode 100644 lib/services/storagesyncmanagement/lib/models/cloudEndpointArray.js delete mode 100644 lib/services/storagesyncmanagement/lib/models/errorDetails.js delete mode 100644 lib/services/storagesyncmanagement/lib/models/errorModel.js delete mode 100644 lib/services/storagesyncmanagement/lib/models/index.d.ts delete mode 100644 lib/services/storagesyncmanagement/lib/models/index.js delete mode 100644 lib/services/storagesyncmanagement/lib/models/operationDisplayInfo.js delete mode 100644 lib/services/storagesyncmanagement/lib/models/operationDisplayResource.js delete mode 100644 lib/services/storagesyncmanagement/lib/models/operationEntity.js delete mode 100644 lib/services/storagesyncmanagement/lib/models/operationEntityListResult.js delete mode 100644 lib/services/storagesyncmanagement/lib/models/postBackupResponse.js delete mode 100644 lib/services/storagesyncmanagement/lib/models/postRestoreRequest.js delete mode 100644 lib/services/storagesyncmanagement/lib/models/preRestoreRequest.js delete mode 100644 lib/services/storagesyncmanagement/lib/models/registeredServer.js delete mode 100644 lib/services/storagesyncmanagement/lib/models/registeredServerArray.js delete mode 100644 lib/services/storagesyncmanagement/lib/models/resource.js delete mode 100644 lib/services/storagesyncmanagement/lib/models/resourcesMoveInfo.js delete mode 100644 lib/services/storagesyncmanagement/lib/models/restoreFileSpec.js delete mode 100644 lib/services/storagesyncmanagement/lib/models/serverEndpoint.js delete mode 100644 lib/services/storagesyncmanagement/lib/models/serverEndpointArray.js delete mode 100644 lib/services/storagesyncmanagement/lib/models/storageSyncError.js delete mode 100644 lib/services/storagesyncmanagement/lib/models/storageSyncErrorDetails.js delete mode 100644 lib/services/storagesyncmanagement/lib/models/storageSyncService.js delete mode 100644 lib/services/storagesyncmanagement/lib/models/storageSyncServiceArray.js delete mode 100644 lib/services/storagesyncmanagement/lib/models/subscriptionState.js delete mode 100644 lib/services/storagesyncmanagement/lib/models/syncGroup.js delete mode 100644 lib/services/storagesyncmanagement/lib/models/syncGroupArray.js delete mode 100644 lib/services/storagesyncmanagement/lib/models/trackedResource.js delete mode 100644 lib/services/storagesyncmanagement/lib/models/workflow.js delete mode 100644 lib/services/storagesyncmanagement/lib/models/workflowArray.js delete mode 100644 lib/services/storagesyncmanagement/lib/operations/abortWorkflows.js delete mode 100644 lib/services/storagesyncmanagement/lib/operations/cloudEndpointPostBackup.js delete mode 100644 lib/services/storagesyncmanagement/lib/operations/cloudEndpointPostRestore.js delete mode 100644 lib/services/storagesyncmanagement/lib/operations/cloudEndpointPreBackup.js delete mode 100644 lib/services/storagesyncmanagement/lib/operations/cloudEndpointPreRestore.js delete mode 100644 lib/services/storagesyncmanagement/lib/operations/cloudEndpointRestoreHeatbeat.js delete mode 100644 lib/services/storagesyncmanagement/lib/operations/cloudEndpoints.js delete mode 100644 lib/services/storagesyncmanagement/lib/operations/cloudEndpointsGet.js delete mode 100644 lib/services/storagesyncmanagement/lib/operations/getSyncGroups.js delete mode 100644 lib/services/storagesyncmanagement/lib/operations/index.d.ts delete mode 100644 lib/services/storagesyncmanagement/lib/operations/index.js delete mode 100644 lib/services/storagesyncmanagement/lib/operations/operationGet.js delete mode 100644 lib/services/storagesyncmanagement/lib/operations/operations.js delete mode 100644 lib/services/storagesyncmanagement/lib/operations/registeredServers.js delete mode 100644 lib/services/storagesyncmanagement/lib/operations/registeredServersGet.js delete mode 100644 lib/services/storagesyncmanagement/lib/operations/serverEndpointRecall.js delete mode 100644 lib/services/storagesyncmanagement/lib/operations/serverEndpoints.js delete mode 100644 lib/services/storagesyncmanagement/lib/operations/serverEndpointsGet.js delete mode 100644 lib/services/storagesyncmanagement/lib/operations/storageSyncServiceByResourceGroupGet.js delete mode 100644 lib/services/storagesyncmanagement/lib/operations/storageSyncServiceGet.js delete mode 100644 lib/services/storagesyncmanagement/lib/operations/storageSyncServices.js delete mode 100644 lib/services/storagesyncmanagement/lib/operations/syncGroups.js delete mode 100644 lib/services/storagesyncmanagement/lib/operations/workflows.js delete mode 100644 lib/services/storagesyncmanagement/lib/storageSyncManagementClient.d.ts delete mode 100644 lib/services/storagesyncmanagement/lib/storageSyncManagementClient.js delete mode 100644 lib/services/storagesyncmanagement/package-lock.json delete mode 100644 lib/services/storagesyncmanagement/package.json diff --git a/lib/services/storagesyncManagement/LICENSE.txt b/lib/services/storagesyncManagement/LICENSE.txt deleted file mode 100644 index 5431ba98b9..0000000000 --- a/lib/services/storagesyncManagement/LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -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 deleted file mode 100644 index 266b0589d5..0000000000 --- a/lib/services/storagesyncManagement/README.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -uid: azure-arm-storagesync -summary: *content - ---- -# 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** - -## Features - - -## How to Install - -```bash -npm install azure-arm-storagesync -``` - -## How to use - -### Authentication, client creation and list operations as an example. - -```javascript -const msRestAzure = require("ms-rest-azure"); -const StorageSyncManagementClient = require("azure-arm-storagesync"); -msRestAzure.interactiveLogin().then((creds) => { - const subscriptionId = ""; - const client = new StorageSyncManagementClient(creds, subscriptionId); - return client.operations.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 deleted file mode 100644 index 94ee20f2c1..0000000000 --- a/lib/services/storagesyncManagement/lib/microsoftStorageSync.d.ts +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -import { 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 deleted file mode 100644 index 8428da46f1..0000000000 --- a/lib/services/storagesyncManagement/lib/microsoftStorageSync.js +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -/* 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 deleted file mode 100644 index a87ef97efb..0000000000 --- a/lib/services/storagesyncManagement/lib/models/backupRequest.js +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 8143070314..0000000000 --- a/lib/services/storagesyncManagement/lib/models/cloudEndpoint.js +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 - * @member {string} [lastOperationName] Resource Last Operation Name - */ - 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, - readOnly: true, - serializedName: 'properties.backupEnabled', - type: { - name: 'Boolean' - } - }, - provisioningState: { - required: false, - serializedName: 'properties.provisioningState', - type: { - name: 'String' - } - }, - lastWorkflowId: { - required: false, - serializedName: 'properties.lastWorkflowId', - type: { - name: 'String' - } - }, - lastOperationName: { - required: false, - serializedName: 'properties.lastOperationName', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = CloudEndpoint; diff --git a/lib/services/storagesyncManagement/lib/models/cloudEndpointArray.js b/lib/services/storagesyncManagement/lib/models/cloudEndpointArray.js deleted file mode 100644 index 9cbf3ca987..0000000000 --- a/lib/services/storagesyncManagement/lib/models/cloudEndpointArray.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 0754c92926..0000000000 --- a/lib/services/storagesyncManagement/lib/models/errorDetails.js +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index bf9f0cf878..0000000000 --- a/lib/services/storagesyncManagement/lib/models/errorModel.js +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 739d5206e3..0000000000 --- a/lib/services/storagesyncManagement/lib/models/index.d.ts +++ /dev/null @@ -1,544 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -import { 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 StorageSyncErrorDetails 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 StorageSyncErrorDetails { - code?: string; - message?: string; - target?: string; -} - -/** - * @class - * Initializes a new instance of the StorageSyncError 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 StorageSyncError { - code?: string; - message?: string; - details?: StorageSyncErrorDetails; -} - -/** - * @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; - readonly 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 - * @member {string} [lastOperationName] Resource Last Operation Name - */ -export interface CloudEndpoint extends BaseResource { - storageAccountKey?: string; - storageAccount?: string; - storageAccountResourceId?: string; - storageAccountShareName?: string; - storageAccountTenantId?: string; - partnershipId?: string; - friendlyName?: string; - readonly backupEnabled?: boolean; - provisioningState?: string; - lastWorkflowId?: string; - lastOperationName?: 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 {string} [serverResourceId] Server Resource Id. - * @member {string} [provisioningState] ServerEndpoint Provisioning State - * @member {string} [lastWorkflowId] ServerEndpoint lastWorkflowId - * @member {string} [lastOperationName] Resource Last Operation Name - * @member {object} [syncStatus] Sync Health Status - */ -export interface ServerEndpoint extends BaseResource { - serverLocalPath?: string; - cloudTiering?: string; - volumeFreeSpacePercent?: number; - friendlyName?: string; - serverResourceId?: string; - provisioningState?: string; - lastWorkflowId?: string; - lastOperationName?: string; - syncStatus?: any; -} - -/** - * @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 - * @member {string} [lastOperationName] Resource Last Operation Name - * @member {string} [discoveryEndpointUri] Resource discoveryEndpointUri - * @member {string} [resourceLocation] Resource Location - * @member {string} [serviceLocation] Service Location - * @member {string} [friendlyName] Friendly Name - * @member {string} [managementEndpointUri] Management Endpoint Uri - */ -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; - lastOperationName?: string; - discoveryEndpointUri?: string; - resourceLocation?: string; - serviceLocation?: string; - friendlyName?: string; - managementEndpointUri?: 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 CheckNameAvailabilityParameters class. - * @constructor - * Parameters for a check name availability request. - * - * @member {string} name The name to check for availability - */ -export interface CheckNameAvailabilityParameters { - name: string; -} - -/** - * @class - * Initializes a new instance of the CheckNameAvailabilityResult class. - * @constructor - * The CheckNameAvailability operation response. - * - * @member {boolean} [nameAvailable] Gets a boolean value that indicates - * whether the name is available for you to use. If true, the name is - * available. If false, the name has already been taken or invalid and cannot - * be used. - * @member {string} [reason] Gets the reason that a Storage Sync Service name - * could not be used. The Reason element is only returned if NameAvailable is - * false. Possible values include: 'Invalid', 'AlreadyExists' - * @member {string} [message] Gets an error message explaining the Reason value - * in more detail. - */ -export interface CheckNameAvailabilityResult { - readonly nameAvailable?: boolean; - readonly reason?: string; - readonly message?: 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; - readonly 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 deleted file mode 100644 index e4896fad4c..0000000000 --- a/lib/services/storagesyncManagement/lib/models/index.js +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -/* 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.StorageSyncErrorDetails = require('./storageSyncErrorDetails'); -exports.StorageSyncError = require('./storageSyncError'); -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.CheckNameAvailabilityParameters = require('./checkNameAvailabilityParameters'); -exports.CheckNameAvailabilityResult = require('./checkNameAvailabilityResult'); -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 deleted file mode 100644 index cf5183c004..0000000000 --- a/lib/services/storagesyncManagement/lib/models/operationDisplayInfo.js +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 5e67311540..0000000000 --- a/lib/services/storagesyncManagement/lib/models/operationDisplayResource.js +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index e7a1b503f7..0000000000 --- a/lib/services/storagesyncManagement/lib/models/operationEntity.js +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -/** - * 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 deleted file mode 100644 index f2fd520020..0000000000 --- a/lib/services/storagesyncManagement/lib/models/operationEntityListResult.js +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index dfb4c14bf1..0000000000 --- a/lib/services/storagesyncManagement/lib/models/postBackupResponse.js +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 32be654193..0000000000 --- a/lib/services/storagesyncManagement/lib/models/postRestoreRequest.js +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -/** - * 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 deleted file mode 100644 index 47c2c0e206..0000000000 --- a/lib/services/storagesyncManagement/lib/models/preRestoreRequest.js +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -/** - * 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 deleted file mode 100644 index cfa338c603..0000000000 --- a/lib/services/storagesyncManagement/lib/models/registeredServer.js +++ /dev/null @@ -1,221 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 - * @member {string} [lastOperationName] Resource Last Operation Name - * @member {string} [discoveryEndpointUri] Resource discoveryEndpointUri - * @member {string} [resourceLocation] Resource Location - * @member {string} [serviceLocation] Service Location - * @member {string} [friendlyName] Friendly Name - * @member {string} [managementEndpointUri] Management Endpoint Uri - */ - 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' - } - }, - lastOperationName: { - required: false, - serializedName: 'properties.lastOperationName', - type: { - name: 'String' - } - }, - discoveryEndpointUri: { - required: false, - serializedName: 'properties.discoveryEndpointUri', - type: { - name: 'String' - } - }, - resourceLocation: { - required: false, - serializedName: 'properties.resourceLocation', - type: { - name: 'String' - } - }, - serviceLocation: { - required: false, - serializedName: 'properties.serviceLocation', - type: { - name: 'String' - } - }, - friendlyName: { - required: false, - serializedName: 'properties.friendlyName', - type: { - name: 'String' - } - }, - managementEndpointUri: { - required: false, - serializedName: 'properties.managementEndpointUri', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = RegisteredServer; diff --git a/lib/services/storagesyncManagement/lib/models/registeredServerArray.js b/lib/services/storagesyncManagement/lib/models/registeredServerArray.js deleted file mode 100644 index aa08378a41..0000000000 --- a/lib/services/storagesyncManagement/lib/models/registeredServerArray.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 41b5d5e0a9..0000000000 --- a/lib/services/storagesyncManagement/lib/models/resource.js +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index a7b26c132f..0000000000 --- a/lib/services/storagesyncManagement/lib/models/resourcesMoveInfo.js +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 1f6eb235f7..0000000000 --- a/lib/services/storagesyncManagement/lib/models/restoreFileSpec.js +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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, - readOnly: true, - 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 deleted file mode 100644 index 98554e6aa1..0000000000 --- a/lib/services/storagesyncManagement/lib/models/serverEndpoint.js +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 {string} [serverResourceId] Server Resource Id. - * @member {string} [provisioningState] ServerEndpoint Provisioning State - * @member {string} [lastWorkflowId] ServerEndpoint lastWorkflowId - * @member {string} [lastOperationName] Resource Last Operation Name - * @member {object} [syncStatus] Sync Health Status - */ - 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' - } - }, - 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' - } - }, - lastOperationName: { - required: false, - serializedName: 'properties.lastOperationName', - type: { - name: 'String' - } - }, - syncStatus: { - required: false, - serializedName: 'properties.syncStatus', - type: { - name: 'Object' - } - } - } - } - }; - } -} - -module.exports = ServerEndpoint; diff --git a/lib/services/storagesyncManagement/lib/models/serverEndpointArray.js b/lib/services/storagesyncManagement/lib/models/serverEndpointArray.js deleted file mode 100644 index 3313291c3a..0000000000 --- a/lib/services/storagesyncManagement/lib/models/serverEndpointArray.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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/storageSyncError.js b/lib/services/storagesyncManagement/lib/models/storageSyncError.js deleted file mode 100644 index b185128307..0000000000 --- a/lib/services/storagesyncManagement/lib/models/storageSyncError.js +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -/** - * 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 deleted file mode 100644 index d8fe07560a..0000000000 --- a/lib/services/storagesyncManagement/lib/models/storageSyncErrorDetails.js +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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/storageSyncService.js b/lib/services/storagesyncManagement/lib/models/storageSyncService.js deleted file mode 100644 index f6b979f943..0000000000 --- a/lib/services/storagesyncManagement/lib/models/storageSyncService.js +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 1886f79e23..0000000000 --- a/lib/services/storagesyncManagement/lib/models/storageSyncServiceArray.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index cf77bf1f05..0000000000 --- a/lib/services/storagesyncManagement/lib/models/subscriptionState.js +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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, - readOnly: true, - 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 deleted file mode 100644 index 37720481d2..0000000000 --- a/lib/services/storagesyncManagement/lib/models/syncGroup.js +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index cc7e29f5cc..0000000000 --- a/lib/services/storagesyncManagement/lib/models/syncGroupArray.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 1daf584523..0000000000 --- a/lib/services/storagesyncManagement/lib/models/trackedResource.js +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 5e92ffff83..0000000000 --- a/lib/services/storagesyncManagement/lib/models/workflow.js +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index c2c3eb737f..0000000000 --- a/lib/services/storagesyncManagement/lib/models/workflowArray.js +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -/** - * 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 deleted file mode 100644 index 4da18b23b5..0000000000 --- a/lib/services/storagesyncManagement/lib/operations/abortWorkflows.js +++ /dev/null @@ -1,273 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index e8d0a62753..0000000000 --- a/lib/services/storagesyncManagement/lib/operations/cloudEndpointPostBackup.js +++ /dev/null @@ -1,526 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 46e09ceebf..0000000000 --- a/lib/services/storagesyncManagement/lib/operations/cloudEndpointPostRestore.js +++ /dev/null @@ -1,581 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index fc0b51f0c0..0000000000 --- a/lib/services/storagesyncManagement/lib/operations/cloudEndpointPreBackup.js +++ /dev/null @@ -1,491 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index d1ab455b76..0000000000 --- a/lib/services/storagesyncManagement/lib/operations/cloudEndpointPreRestore.js +++ /dev/null @@ -1,605 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index f0ba51e445..0000000000 --- a/lib/services/storagesyncManagement/lib/operations/cloudEndpointRestoreHeatbeat.js +++ /dev/null @@ -1,283 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 3227f0ef9f..0000000000 --- a/lib/services/storagesyncManagement/lib/operations/cloudEndpoints.js +++ /dev/null @@ -1,3986 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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} parameters Body of Cloud Endpoint resource. - * - * @param {string} [parameters.storageAccountKey] Storage Account access key. - * - * @param {string} [parameters.storageAccount] Storage Account name. - * - * @param {string} [parameters.storageAccountResourceId] Storage Account - * Resource Id - * - * @param {string} [parameters.storageAccountShareName] Storage Account Share - * name - * - * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant - * Id - * - * @param {string} [parameters.partnershipId] Partnership Id - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation 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 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, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - - if (!callback) { - throw new Error('callback cannot be null.'); - } - - // Send request - this.beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, parsedResult, httpRequest, response) => { - if (err) return callback(err); - - let initialResult = new msRest.HttpOperationResponse(); - initialResult.request = httpRequest; - initialResult.response = response; - initialResult.body = response.body; - client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { - if (err) return callback(err); - - // Create Result - let result = null; - - httpRequest = pollingResult.request; - response = pollingResult.response; - let responseBody = pollingResult.body; - if (responseBody === '') responseBody = null; - - // Deserialize Response - let parsedResponse = null; - try { - parsedResponse = JSON.parse(responseBody); - result = JSON.parse(responseBody); - if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['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['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 _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); - }); - }); -} - -/** - * 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['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['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); - }); -} - - -/** - * 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} parameters Body of Backup request. - * - * @param {string} [parameters.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 _preBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - - if (!callback) { - throw new Error('callback cannot be null.'); - } - - // Send request - this.beginPreBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, parsedResult, httpRequest, response) => { - if (err) return callback(err); - - let initialResult = new msRest.HttpOperationResponse(); - initialResult.request = httpRequest; - initialResult.response = response; - initialResult.body = response.body; - client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { - if (err) return callback(err); - - // Create Result - let result = null; - - httpRequest = pollingResult.request; - response = pollingResult.response; - let responseBody = pollingResult.body; - if (responseBody === '') responseBody = null; - - // Deserialize Response - - return callback(null, result, httpRequest, response); - }); - }); -} - - -/** - * 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} parameters Body of Backup request. - * - * @param {string} [parameters.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, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - - if (!callback) { - throw new Error('callback cannot be null.'); - } - - // Send request - this.beginPostBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, parsedResult, httpRequest, response) => { - if (err) return callback(err); - - let initialResult = new msRest.HttpOperationResponse(); - initialResult.request = httpRequest; - initialResult.response = response; - initialResult.body = response.body; - client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { - if (err) return callback(err); - - // Create Result - let result = null; - - httpRequest = pollingResult.request; - response = pollingResult.response; - let responseBody = pollingResult.body; - if (responseBody === '') responseBody = null; - - // Deserialize Response - let parsedResponse = null; - try { - parsedResponse = JSON.parse(responseBody); - result = JSON.parse(responseBody); - if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Pre Restore partition. - * - * @param {string} [parameters.replicaGroup] Pre Restore replica group. - * - * @param {string} [parameters.requestId] Pre Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Pre Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup - * metadata property bag. - * - * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec - * array. - * - * @param {number} [parameters.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, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - - if (!callback) { - throw new Error('callback cannot be null.'); - } - - // Send request - this.beginPreRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, parsedResult, httpRequest, response) => { - if (err) return callback(err); - - let initialResult = new msRest.HttpOperationResponse(); - initialResult.request = httpRequest; - initialResult.response = response; - initialResult.body = response.body; - client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { - if (err) return callback(err); - - // Create Result - let result = null; - - httpRequest = pollingResult.request; - response = pollingResult.response; - let responseBody = pollingResult.body; - if (responseBody === '') responseBody = null; - - // Deserialize Response - - return callback(null, result, httpRequest, response); - }); - }); -} - -/** - * 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 _restoreheartbeat(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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Post Restore partition. - * - * @param {string} [parameters.replicaGroup] Post Restore replica group. - * - * @param {string} [parameters.requestId] Post Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Post Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.failedFileList] Post Restore Azure failed file - * list. - * - * @param {array} [parameters.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, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - - if (!callback) { - throw new Error('callback cannot be null.'); - } - - // Send request - this.beginPostRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, parsedResult, httpRequest, response) => { - if (err) return callback(err); - - let initialResult = new msRest.HttpOperationResponse(); - initialResult.request = httpRequest; - initialResult.response = response; - initialResult.body = response.body; - client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { - if (err) return callback(err); - - // Create Result - let result = null; - - httpRequest = pollingResult.request; - response = pollingResult.response; - let responseBody = pollingResult.body; - if (responseBody === '') responseBody = null; - - // Deserialize Response - - return callback(null, result, httpRequest, response); - }); - }); -} - -/** - * 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} parameters Body of Cloud Endpoint resource. - * - * @param {string} [parameters.storageAccountKey] Storage Account access key. - * - * @param {string} [parameters.storageAccount] Storage Account name. - * - * @param {string} [parameters.storageAccountResourceId] Storage Account - * Resource Id - * - * @param {string} [parameters.storageAccountShareName] Storage Account Share - * name - * - * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant - * Id - * - * @param {string} [parameters.partnershipId] Partnership Id - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation 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 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, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - if (!callback) { - throw new Error('callback cannot be null.'); - } - // Validate - try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { - throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); - } - if (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 (parameters === null || parameters === undefined) { - throw new Error('parameters cannot be null or undefined.'); - } - if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { - throw new Error('this.client.acceptLanguage must be of type string.'); - } - } catch (error) { - return callback(error); - } - - // Construct URL - let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['CloudEndpoint']().mapper(); - requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(parameters, null, 2)}.`); - return callback(serializationError); - } - httpRequest.body = requestContent; - // Send Request - return client.pipeline(httpRequest, (err, response, responseBody) => { - if (err) { - return callback(err); - } - let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 202) { - let error = new Error(responseBody); - error.statusCode = response.statusCode; - error.request = msRest.stripRequest(httpRequest); - error.response = msRest.stripResponse(response); - if (responseBody === '') responseBody = null; - let parsedErrorResponse; - try { - parsedErrorResponse = JSON.parse(responseBody); - if (parsedErrorResponse) { - let internalError = null; - if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; - error.code = internalError ? internalError.code : parsedErrorResponse.code; - error.message = internalError ? internalError.message : parsedErrorResponse.message; - } - if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['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} parameters Body of Backup request. - * - * @param {string} [parameters.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, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - if (!callback) { - throw new Error('callback cannot be null.'); - } - // Validate - try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { - throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); - } - if (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 (parameters === null || parameters === undefined) { - throw new Error('parameters cannot be null or undefined.'); - } - if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { - throw new Error('this.client.acceptLanguage must be of type string.'); - } - } catch (error) { - return callback(error); - } - - // Construct URL - let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['BackupRequest']().mapper(); - requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(parameters, null, 2)}.`); - return callback(serializationError); - } - httpRequest.body = requestContent; - // Send Request - return client.pipeline(httpRequest, (err, response, responseBody) => { - if (err) { - return callback(err); - } - let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 202) { - let error = new Error(responseBody); - error.statusCode = response.statusCode; - error.request = msRest.stripRequest(httpRequest); - error.response = msRest.stripResponse(response); - if (responseBody === '') responseBody = null; - let parsedErrorResponse; - try { - parsedErrorResponse = JSON.parse(responseBody); - if (parsedErrorResponse) { - let internalError = null; - if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; - error.code = internalError ? internalError.code : parsedErrorResponse.code; - error.message = internalError ? internalError.message : parsedErrorResponse.message; - } - if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['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} parameters Body of Backup request. - * - * @param {string} [parameters.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, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - if (!callback) { - throw new Error('callback cannot be null.'); - } - // Validate - try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { - throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); - } - if (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 (parameters === null || parameters === undefined) { - throw new Error('parameters cannot be null or undefined.'); - } - if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { - throw new Error('this.client.acceptLanguage must be of type string.'); - } - } catch (error) { - return callback(error); - } - - // Construct URL - let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['BackupRequest']().mapper(); - requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(parameters, null, 2)}.`); - return callback(serializationError); - } - httpRequest.body = requestContent; - // Send Request - return client.pipeline(httpRequest, (err, response, responseBody) => { - if (err) { - return callback(err); - } - let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 202) { - let error = new Error(responseBody); - error.statusCode = response.statusCode; - error.request = msRest.stripRequest(httpRequest); - error.response = msRest.stripResponse(response); - if (responseBody === '') responseBody = null; - let parsedErrorResponse; - try { - parsedErrorResponse = JSON.parse(responseBody); - if (parsedErrorResponse) { - let internalError = null; - if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; - error.code = internalError ? internalError.code : parsedErrorResponse.code; - error.message = internalError ? internalError.message : parsedErrorResponse.message; - } - if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Pre Restore partition. - * - * @param {string} [parameters.replicaGroup] Pre Restore replica group. - * - * @param {string} [parameters.requestId] Pre Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Pre Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup - * metadata property bag. - * - * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec - * array. - * - * @param {number} [parameters.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, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - if (!callback) { - throw new Error('callback cannot be null.'); - } - // Validate - try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { - throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); - } - if (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 (parameters === null || parameters === undefined) { - throw new Error('parameters cannot be null or undefined.'); - } - if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { - throw new Error('this.client.acceptLanguage must be of type string.'); - } - } catch (error) { - return callback(error); - } - - // Construct URL - let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['PreRestoreRequest']().mapper(); - requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(parameters, null, 2)}.`); - return callback(serializationError); - } - httpRequest.body = requestContent; - // Send Request - return client.pipeline(httpRequest, (err, response, responseBody) => { - if (err) { - return callback(err); - } - let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 202) { - let error = new Error(responseBody); - error.statusCode = response.statusCode; - error.request = msRest.stripRequest(httpRequest); - error.response = msRest.stripResponse(response); - if (responseBody === '') responseBody = null; - let parsedErrorResponse; - try { - parsedErrorResponse = JSON.parse(responseBody); - if (parsedErrorResponse) { - let internalError = null; - if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; - error.code = internalError ? internalError.code : parsedErrorResponse.code; - error.message = internalError ? internalError.message : parsedErrorResponse.message; - } - if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Post Restore partition. - * - * @param {string} [parameters.replicaGroup] Post Restore replica group. - * - * @param {string} [parameters.requestId] Post Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Post Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.failedFileList] Post Restore Azure failed file - * list. - * - * @param {array} [parameters.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, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - if (!callback) { - throw new Error('callback cannot be null.'); - } - // Validate - try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { - throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); - } - if (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 (parameters === null || parameters === undefined) { - throw new Error('parameters cannot be null or undefined.'); - } - if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { - throw new Error('this.client.acceptLanguage must be of type string.'); - } - } catch (error) { - return callback(error); - } - - // Construct URL - let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['PostRestoreRequest']().mapper(); - requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(parameters, null, 2)}.`); - return callback(serializationError); - } - httpRequest.body = requestContent; - // Send Request - return client.pipeline(httpRequest, (err, response, responseBody) => { - if (err) { - return callback(err); - } - let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 202) { - let error = new Error(responseBody); - error.statusCode = response.statusCode; - error.request = msRest.stripRequest(httpRequest); - error.response = msRest.stripResponse(response); - if (responseBody === '') responseBody = null; - let parsedErrorResponse; - try { - parsedErrorResponse = JSON.parse(responseBody); - if (parsedErrorResponse) { - let internalError = null; - if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; - error.code = internalError ? internalError.code : parsedErrorResponse.code; - error.message = internalError ? internalError.message : parsedErrorResponse.message; - } - if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['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._restoreheartbeat = _restoreheartbeat; - 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} parameters Body of Cloud Endpoint resource. - * - * @param {string} [parameters.storageAccountKey] Storage Account access key. - * - * @param {string} [parameters.storageAccount] Storage Account name. - * - * @param {string} [parameters.storageAccountResourceId] Storage Account - * Resource Id - * - * @param {string} [parameters.storageAccountShareName] Storage Account Share - * name - * - * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant - * Id - * - * @param {string} [parameters.partnershipId] Partnership Id - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation 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, syncGroupName, cloudEndpointName, parameters, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - 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); } - 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} parameters Body of Cloud Endpoint resource. - * - * @param {string} [parameters.storageAccountKey] Storage Account access key. - * - * @param {string} [parameters.storageAccount] Storage Account name. - * - * @param {string} [parameters.storageAccountResourceId] Storage Account - * Resource Id - * - * @param {string} [parameters.storageAccountShareName] Storage Account Share - * name - * - * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant - * Id - * - * @param {string} [parameters.partnershipId] Partnership Id - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation 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 {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, parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._create(resourceGroupName, 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, parameters, 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} parameters Body of Backup request. - * - * @param {string} [parameters.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, parameters, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - 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); } - 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} parameters Body of Backup request. - * - * @param {string} [parameters.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, parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._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, parameters, 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} parameters Body of Backup request. - * - * @param {string} [parameters.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, parameters, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - 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); } - 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} parameters Body of Backup request. - * - * @param {string} [parameters.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, parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._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, parameters, 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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Pre Restore partition. - * - * @param {string} [parameters.replicaGroup] Pre Restore replica group. - * - * @param {string} [parameters.requestId] Pre Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Pre Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup - * metadata property bag. - * - * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec - * array. - * - * @param {number} [parameters.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, parameters, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - 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); } - 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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Pre Restore partition. - * - * @param {string} [parameters.replicaGroup] Pre Restore replica group. - * - * @param {string} [parameters.requestId] Pre Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Pre Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup - * metadata property bag. - * - * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec - * array. - * - * @param {number} [parameters.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, parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._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, parameters, 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. - */ - restoreheartbeatWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._restoreheartbeat(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. - */ - restoreheartbeat(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._restoreheartbeat(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._restoreheartbeat(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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Post Restore partition. - * - * @param {string} [parameters.replicaGroup] Post Restore replica group. - * - * @param {string} [parameters.requestId] Post Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Post Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.failedFileList] Post Restore Azure failed file - * list. - * - * @param {array} [parameters.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, parameters, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - 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); } - 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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Post Restore partition. - * - * @param {string} [parameters.replicaGroup] Post Restore replica group. - * - * @param {string} [parameters.requestId] Post Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Post Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.failedFileList] Post Restore Azure failed file - * list. - * - * @param {array} [parameters.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, parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._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, parameters, 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} parameters Body of Cloud Endpoint resource. - * - * @param {string} [parameters.storageAccountKey] Storage Account access key. - * - * @param {string} [parameters.storageAccount] Storage Account name. - * - * @param {string} [parameters.storageAccountResourceId] Storage Account - * Resource Id - * - * @param {string} [parameters.storageAccountShareName] Storage Account Share - * name - * - * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant - * Id - * - * @param {string} [parameters.partnershipId] Partnership Id - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation 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. - */ - 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, parameters, 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} parameters Body of Cloud Endpoint resource. - * - * @param {string} [parameters.storageAccountKey] Storage Account access key. - * - * @param {string} [parameters.storageAccount] Storage Account name. - * - * @param {string} [parameters.storageAccountResourceId] Storage Account - * Resource Id - * - * @param {string} [parameters.storageAccountShareName] Storage Account Share - * name - * - * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant - * Id - * - * @param {string} [parameters.partnershipId] Partnership Id - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation 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 {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, parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._beginCreate(resourceGroupName, 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, parameters, 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); - } - } - - /** - * 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} parameters Body of Backup request. - * - * @param {string} [parameters.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. - */ - 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, parameters, 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} parameters Body of Backup request. - * - * @param {string} [parameters.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. - */ - beginPreBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._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, parameters, 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} parameters Body of Backup request. - * - * @param {string} [parameters.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. - */ - 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, parameters, 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} parameters Body of Backup request. - * - * @param {string} [parameters.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, parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._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, parameters, 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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Pre Restore partition. - * - * @param {string} [parameters.replicaGroup] Pre Restore replica group. - * - * @param {string} [parameters.requestId] Pre Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Pre Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup - * metadata property bag. - * - * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec - * array. - * - * @param {number} [parameters.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. - */ - 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, parameters, 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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Pre Restore partition. - * - * @param {string} [parameters.replicaGroup] Pre Restore replica group. - * - * @param {string} [parameters.requestId] Pre Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Pre Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup - * metadata property bag. - * - * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec - * array. - * - * @param {number} [parameters.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. - */ - beginPreRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._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, parameters, 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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Post Restore partition. - * - * @param {string} [parameters.replicaGroup] Post Restore replica group. - * - * @param {string} [parameters.requestId] Post Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Post Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.failedFileList] Post Restore Azure failed file - * list. - * - * @param {array} [parameters.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. - */ - 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, parameters, 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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Post Restore partition. - * - * @param {string} [parameters.replicaGroup] Post Restore replica group. - * - * @param {string} [parameters.requestId] Post Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Post Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.failedFileList] Post Restore Azure failed file - * list. - * - * @param {array} [parameters.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. - */ - beginPostRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._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, parameters, options, optionalCallback); - } - } - -} - -module.exports = CloudEndpoints; diff --git a/lib/services/storagesyncManagement/lib/operations/cloudEndpointsGet.js b/lib/services/storagesyncManagement/lib/operations/cloudEndpointsGet.js deleted file mode 100644 index d40658182c..0000000000 --- a/lib/services/storagesyncManagement/lib/operations/cloudEndpointsGet.js +++ /dev/null @@ -1,292 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index d51b1421ff..0000000000 --- a/lib/services/storagesyncManagement/lib/operations/getSyncGroups.js +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 74d7e97dc0..0000000000 --- a/lib/services/storagesyncManagement/lib/operations/index.d.ts +++ /dev/null @@ -1,3863 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. -*/ - -import { ServiceClientOptions, RequestOptions, ServiceCallback, HttpOperationResponse } from 'ms-rest'; -import * as models from '../models'; - - -/** - * @class - * Operations - * __NOTE__: An instance of this class is automatically created for an - * instance of the StorageSyncManagementClient. - */ -export interface Operations { - - - /** - * 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 StorageSyncManagementClient. - */ -export interface StorageSyncServices { - - - /** - * Check the give namespace name availability. - * - * @param {string} locationName The desired region for the name check. - * - * @param {object} parameters Parameters to check availability of the given - * namespace name - * - * @param {string} parameters.name The name to check for availability - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [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. - */ - checkNameAvailabilityWithHttpOperationResponse(locationName: string, parameters: models.CheckNameAvailabilityParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Check the give namespace name availability. - * - * @param {string} locationName The desired region for the name check. - * - * @param {object} parameters Parameters to check availability of the given - * namespace name - * - * @param {string} parameters.name The name to check for availability - * - * @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 {CheckNameAvailabilityResult} - 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. - * - * {CheckNameAvailabilityResult} [result] - The deserialized result object if an error did not occur. - * See {@link CheckNameAvailabilityResult} 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. - */ - checkNameAvailability(locationName: string, parameters: models.CheckNameAvailabilityParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - checkNameAvailability(locationName: string, parameters: models.CheckNameAvailabilityParameters, callback: ServiceCallback): void; - checkNameAvailability(locationName: string, parameters: models.CheckNameAvailabilityParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * 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} parameters 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, parameters: 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} parameters 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, 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; - - - /** - * 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.parameters] 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?: { parameters? : 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.parameters] 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?: { parameters? : models.StorageSyncService, customHeaders? : { [headerName: string]: string; } }): Promise; - update(resourceGroupName: string, storageSyncServiceName: string, callback: ServiceCallback): void; - update(resourceGroupName: string, storageSyncServiceName: string, options: { parameters? : 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; - - - /** - * 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. - */ - listByResourceGroupWithHttpOperationResponse(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. - */ - 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; - - - /** - * 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 - * SyncGroups - * __NOTE__: An instance of this class is automatically created for an - * instance of the StorageSyncManagementClient. - */ -export interface SyncGroups { - - - /** - * 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; - - - /** - * 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} parameters Sync Group Body - * - * @param {string} [parameters.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, parameters: 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} parameters Sync Group Body - * - * @param {string} [parameters.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, 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; - - - /** - * 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 StorageSyncManagementClient. - */ -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} parameters Body of Cloud Endpoint resource. - * - * @param {string} [parameters.storageAccountKey] Storage Account access key. - * - * @param {string} [parameters.storageAccount] Storage Account name. - * - * @param {string} [parameters.storageAccountResourceId] Storage Account - * Resource Id - * - * @param {string} [parameters.storageAccountShareName] Storage Account Share - * name - * - * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant - * Id - * - * @param {string} [parameters.partnershipId] Partnership Id - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation 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, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Cloud Endpoint resource. - * - * @param {string} [parameters.storageAccountKey] Storage Account access key. - * - * @param {string} [parameters.storageAccount] Storage Account name. - * - * @param {string} [parameters.storageAccountResourceId] Storage Account - * Resource Id - * - * @param {string} [parameters.storageAccountShareName] Storage Account Share - * name - * - * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant - * Id - * - * @param {string} [parameters.partnershipId] Partnership Id - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation 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 {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, 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; - - - /** - * 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; - - - /** - * 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; - - - /** - * 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} parameters Body of Backup request. - * - * @param {string} [parameters.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. - */ - preBackupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Backup request. - * - * @param {string} [parameters.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. - */ - 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; - - - /** - * 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} parameters Body of Backup request. - * - * @param {string} [parameters.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. - */ - postBackupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Backup request. - * - * @param {string} [parameters.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. - */ - 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; - - - /** - * 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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Pre Restore partition. - * - * @param {string} [parameters.replicaGroup] Pre Restore replica group. - * - * @param {string} [parameters.requestId] Pre Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Pre Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup - * metadata property bag. - * - * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec - * array. - * - * @param {number} [parameters.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. - */ - preRestoreWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Pre Restore partition. - * - * @param {string} [parameters.replicaGroup] Pre Restore replica group. - * - * @param {string} [parameters.requestId] Pre Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Pre Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup - * metadata property bag. - * - * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec - * array. - * - * @param {number} [parameters.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. - */ - 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; - - - /** - * 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. - */ - restoreheartbeatWithHttpOperationResponse(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. - */ - restoreheartbeat(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - restoreheartbeat(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, callback: ServiceCallback): void; - restoreheartbeat(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, 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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Post Restore partition. - * - * @param {string} [parameters.replicaGroup] Post Restore replica group. - * - * @param {string} [parameters.requestId] Post Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Post Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.failedFileList] Post Restore Azure failed file - * list. - * - * @param {array} [parameters.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. - */ - postRestoreWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Post Restore partition. - * - * @param {string} [parameters.replicaGroup] Post Restore replica group. - * - * @param {string} [parameters.requestId] Post Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Post Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.failedFileList] Post Restore Azure failed file - * list. - * - * @param {array} [parameters.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. - */ - 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; - - - /** - * 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} parameters Body of Cloud Endpoint resource. - * - * @param {string} [parameters.storageAccountKey] Storage Account access key. - * - * @param {string} [parameters.storageAccount] Storage Account name. - * - * @param {string} [parameters.storageAccountResourceId] Storage Account - * Resource Id - * - * @param {string} [parameters.storageAccountShareName] Storage Account Share - * name - * - * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant - * Id - * - * @param {string} [parameters.partnershipId] Partnership Id - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation 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. - */ - beginCreateWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Cloud Endpoint resource. - * - * @param {string} [parameters.storageAccountKey] Storage Account access key. - * - * @param {string} [parameters.storageAccount] Storage Account name. - * - * @param {string} [parameters.storageAccountResourceId] Storage Account - * Resource Id - * - * @param {string} [parameters.storageAccountShareName] Storage Account Share - * name - * - * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant - * Id - * - * @param {string} [parameters.partnershipId] Partnership Id - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation 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 {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, 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; - - - /** - * 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; - - - /** - * 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} parameters Body of Backup request. - * - * @param {string} [parameters.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. - */ - beginPreBackupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Backup request. - * - * @param {string} [parameters.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. - */ - 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; - - - /** - * 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} parameters Body of Backup request. - * - * @param {string} [parameters.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. - */ - beginPostBackupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Backup request. - * - * @param {string} [parameters.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. - */ - 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; - - - /** - * 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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Pre Restore partition. - * - * @param {string} [parameters.replicaGroup] Pre Restore replica group. - * - * @param {string} [parameters.requestId] Pre Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Pre Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup - * metadata property bag. - * - * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec - * array. - * - * @param {number} [parameters.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. - */ - beginPreRestoreWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Pre Restore partition. - * - * @param {string} [parameters.replicaGroup] Pre Restore replica group. - * - * @param {string} [parameters.requestId] Pre Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Pre Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup - * metadata property bag. - * - * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec - * array. - * - * @param {number} [parameters.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. - */ - 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; - - - /** - * 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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Post Restore partition. - * - * @param {string} [parameters.replicaGroup] Post Restore replica group. - * - * @param {string} [parameters.requestId] Post Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Post Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.failedFileList] Post Restore Azure failed file - * list. - * - * @param {array} [parameters.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. - */ - beginPostRestoreWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Post Restore partition. - * - * @param {string} [parameters.replicaGroup] Post Restore replica group. - * - * @param {string} [parameters.requestId] Post Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Post Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.failedFileList] Post Restore Azure failed file - * list. - * - * @param {array} [parameters.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. - */ - 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; -} - -/** - * @class - * ServerEndpoints - * __NOTE__: An instance of this class is automatically created for an - * instance of the StorageSyncManagementClient. - */ -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} parameters Body of Server Endpoint object. - * - * @param {string} [parameters.serverLocalPath] Server Local path. - * - * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values - * include: 'on', 'off' - * - * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to - * be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.serverResourceId] Server Resource Id. - * - * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {object} [parameters.syncStatus] Sync Health Status - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [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, parameters: 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} parameters Body of Server Endpoint object. - * - * @param {string} [parameters.serverLocalPath] Server Local path. - * - * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values - * include: 'on', 'off' - * - * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to - * be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.serverResourceId] Server Resource Id. - * - * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {object} [parameters.syncStatus] Sync Health Status - * - * @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, 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; - - - /** - * 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.parameters] Any of the properties applicable in PUT - * request. - * - * @param {string} [options.parameters.serverLocalPath] Server Local path. - * - * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible - * values include: 'on', 'off' - * - * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free - * space to be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [options.parameters.friendlyName] Friendly Name - * - * @param {string} [options.parameters.serverResourceId] Server Resource Id. - * - * @param {string} [options.parameters.provisioningState] ServerEndpoint - * Provisioning State - * - * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint - * lastWorkflowId - * - * @param {string} [options.parameters.lastOperationName] Resource Last - * Operation Name - * - * @param {object} [options.parameters.syncStatus] Sync Health Status - * - * @param {object} [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?: { parameters? : 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.parameters] Any of the properties applicable in PUT - * request. - * - * @param {string} [options.parameters.serverLocalPath] Server Local path. - * - * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible - * values include: 'on', 'off' - * - * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free - * space to be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [options.parameters.friendlyName] Friendly Name - * - * @param {string} [options.parameters.serverResourceId] Server Resource Id. - * - * @param {string} [options.parameters.provisioningState] ServerEndpoint - * Provisioning State - * - * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint - * lastWorkflowId - * - * @param {string} [options.parameters.lastOperationName] Resource Last - * Operation Name - * - * @param {object} [options.parameters.syncStatus] Sync Health Status - * - * @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?: { 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: { parameters? : 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; - - - /** - * 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; - - - /** - * 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. - */ - recallActionWithHttpOperationResponse(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. - */ - recallAction(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - recallAction(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, callback: ServiceCallback): void; - recallAction(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} parameters Body of Server Endpoint object. - * - * @param {string} [parameters.serverLocalPath] Server Local path. - * - * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values - * include: 'on', 'off' - * - * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to - * be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.serverResourceId] Server Resource Id. - * - * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {object} [parameters.syncStatus] Sync Health Status - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [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, parameters: 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} parameters Body of Server Endpoint object. - * - * @param {string} [parameters.serverLocalPath] Server Local path. - * - * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values - * include: 'on', 'off' - * - * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to - * be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.serverResourceId] Server Resource Id. - * - * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {object} [parameters.syncStatus] Sync Health Status - * - * @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, 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; - - - /** - * 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.parameters] Any of the properties applicable in PUT - * request. - * - * @param {string} [options.parameters.serverLocalPath] Server Local path. - * - * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible - * values include: 'on', 'off' - * - * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free - * space to be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [options.parameters.friendlyName] Friendly Name - * - * @param {string} [options.parameters.serverResourceId] Server Resource Id. - * - * @param {string} [options.parameters.provisioningState] ServerEndpoint - * Provisioning State - * - * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint - * lastWorkflowId - * - * @param {string} [options.parameters.lastOperationName] Resource Last - * Operation Name - * - * @param {object} [options.parameters.syncStatus] Sync Health Status - * - * @param {object} [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?: { parameters? : 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.parameters] Any of the properties applicable in PUT - * request. - * - * @param {string} [options.parameters.serverLocalPath] Server Local path. - * - * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible - * values include: 'on', 'off' - * - * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free - * space to be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [options.parameters.friendlyName] Friendly Name - * - * @param {string} [options.parameters.serverResourceId] Server Resource Id. - * - * @param {string} [options.parameters.provisioningState] ServerEndpoint - * Provisioning State - * - * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint - * lastWorkflowId - * - * @param {string} [options.parameters.lastOperationName] Resource Last - * Operation Name - * - * @param {object} [options.parameters.syncStatus] Sync Health Status - * - * @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?: { 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: { parameters? : 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; - - - /** - * 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. - */ - beginRecallActionWithHttpOperationResponse(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. - */ - beginRecallAction(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginRecallAction(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, callback: ServiceCallback): void; - beginRecallAction(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: 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 StorageSyncManagementClient. - */ -export interface RegisteredServers { - - - /** - * 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; - - - /** - * 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} parameters Body of Registered Server object. - * - * @param {string} [parameters.serverCertificate] Registered Server Certificate - * - * @param {string} [parameters.agentVersion] Registered Server Agent Version - * - * @param {string} [parameters.serverOSVersion] Registered Server OS Version - * - * @param {number} [parameters.serverManagementtErrorCode] Registered Server - * Management Error Code - * - * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat - * - * @param {string} [parameters.provisioningState] Registered Server - * Provisioning State - * - * @param {string} [parameters.serverRole] Registered Server serverRole - * - * @param {string} [parameters.clusterId] Registered Server clusterId - * - * @param {string} [parameters.clusterName] Registered Server clusterName - * - * @param {string} [parameters.serverId] Registered Server serverId - * - * @param {string} [parameters.storageSyncServiceUid] Registered Server - * storageSyncServiceUid - * - * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {string} [parameters.discoveryEndpointUri] Resource - * discoveryEndpointUri - * - * @param {string} [parameters.resourceLocation] Resource Location - * - * @param {string} [parameters.serviceLocation] Service Location - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [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, parameters: 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} parameters Body of Registered Server object. - * - * @param {string} [parameters.serverCertificate] Registered Server Certificate - * - * @param {string} [parameters.agentVersion] Registered Server Agent Version - * - * @param {string} [parameters.serverOSVersion] Registered Server OS Version - * - * @param {number} [parameters.serverManagementtErrorCode] Registered Server - * Management Error Code - * - * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat - * - * @param {string} [parameters.provisioningState] Registered Server - * Provisioning State - * - * @param {string} [parameters.serverRole] Registered Server serverRole - * - * @param {string} [parameters.clusterId] Registered Server clusterId - * - * @param {string} [parameters.clusterName] Registered Server clusterName - * - * @param {string} [parameters.serverId] Registered Server serverId - * - * @param {string} [parameters.storageSyncServiceUid] Registered Server - * storageSyncServiceUid - * - * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {string} [parameters.discoveryEndpointUri] Resource - * discoveryEndpointUri - * - * @param {string} [parameters.resourceLocation] Resource Location - * - * @param {string} [parameters.serviceLocation] Service Location - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri - * - * @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, 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; - - - /** - * 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} parameters Body of Registered Server object. - * - * @param {string} [parameters.serverCertificate] Registered Server Certificate - * - * @param {string} [parameters.agentVersion] Registered Server Agent Version - * - * @param {string} [parameters.serverOSVersion] Registered Server OS Version - * - * @param {number} [parameters.serverManagementtErrorCode] Registered Server - * Management Error Code - * - * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat - * - * @param {string} [parameters.provisioningState] Registered Server - * Provisioning State - * - * @param {string} [parameters.serverRole] Registered Server serverRole - * - * @param {string} [parameters.clusterId] Registered Server clusterId - * - * @param {string} [parameters.clusterName] Registered Server clusterName - * - * @param {string} [parameters.serverId] Registered Server serverId - * - * @param {string} [parameters.storageSyncServiceUid] Registered Server - * storageSyncServiceUid - * - * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {string} [parameters.discoveryEndpointUri] Resource - * discoveryEndpointUri - * - * @param {string} [parameters.resourceLocation] Resource Location - * - * @param {string} [parameters.serviceLocation] Service Location - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [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, parameters: 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} parameters Body of Registered Server object. - * - * @param {string} [parameters.serverCertificate] Registered Server Certificate - * - * @param {string} [parameters.agentVersion] Registered Server Agent Version - * - * @param {string} [parameters.serverOSVersion] Registered Server OS Version - * - * @param {number} [parameters.serverManagementtErrorCode] Registered Server - * Management Error Code - * - * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat - * - * @param {string} [parameters.provisioningState] Registered Server - * Provisioning State - * - * @param {string} [parameters.serverRole] Registered Server serverRole - * - * @param {string} [parameters.clusterId] Registered Server clusterId - * - * @param {string} [parameters.clusterName] Registered Server clusterName - * - * @param {string} [parameters.serverId] Registered Server serverId - * - * @param {string} [parameters.storageSyncServiceUid] Registered Server - * storageSyncServiceUid - * - * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {string} [parameters.discoveryEndpointUri] Resource - * discoveryEndpointUri - * - * @param {string} [parameters.resourceLocation] Resource Location - * - * @param {string} [parameters.serviceLocation] Service Location - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri - * - * @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, 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; - - - /** - * 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 StorageSyncManagementClient. - */ -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; - - - /** - * 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. - */ - abortWithHttpOperationResponse(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. - */ - 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 deleted file mode 100644 index 9f76216fd2..0000000000 --- a/lib/services/storagesyncManagement/lib/operations/index.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -/* jshint latedef:false */ -/* jshint forin:false */ -/* jshint noempty:false */ - -'use strict'; - -exports.Operations = require('./operations'); -exports.StorageSyncServices = require('./storageSyncServices'); -exports.SyncGroups = require('./syncGroups'); -exports.CloudEndpoints = require('./cloudEndpoints'); -exports.ServerEndpoints = require('./serverEndpoints'); -exports.RegisteredServers = require('./registeredServers'); -exports.Workflows = require('./workflows'); diff --git a/lib/services/storagesyncManagement/lib/operations/operationGet.js b/lib/services/storagesyncManagement/lib/operations/operationGet.js deleted file mode 100644 index d3040bf98f..0000000000 --- a/lib/services/storagesyncManagement/lib/operations/operationGet.js +++ /dev/null @@ -1,455 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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/operations.js b/lib/services/storagesyncManagement/lib/operations/operations.js deleted file mode 100644 index 2fc78f7549..0000000000 --- a/lib/services/storagesyncManagement/lib/operations/operations.js +++ /dev/null @@ -1,455 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 70c88485da..0000000000 --- a/lib/services/storagesyncManagement/lib/operations/registeredServers.js +++ /dev/null @@ -1,1659 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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['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. - * - * @param {string} resourceGroupName The name 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['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['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} parameters Body of Registered Server object. - * - * @param {string} [parameters.serverCertificate] Registered Server Certificate - * - * @param {string} [parameters.agentVersion] Registered Server Agent Version - * - * @param {string} [parameters.serverOSVersion] Registered Server OS Version - * - * @param {number} [parameters.serverManagementtErrorCode] Registered Server - * Management Error Code - * - * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat - * - * @param {string} [parameters.provisioningState] Registered Server - * Provisioning State - * - * @param {string} [parameters.serverRole] Registered Server serverRole - * - * @param {string} [parameters.clusterId] Registered Server clusterId - * - * @param {string} [parameters.clusterName] Registered Server clusterName - * - * @param {string} [parameters.serverId] Registered Server serverId - * - * @param {string} [parameters.storageSyncServiceUid] Registered Server - * storageSyncServiceUid - * - * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {string} [parameters.discoveryEndpointUri] Resource - * discoveryEndpointUri - * - * @param {string} [parameters.resourceLocation] Resource Location - * - * @param {string} [parameters.serviceLocation] Service Location - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri - * - * @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, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - - if (!callback) { - throw new Error('callback cannot be null.'); - } - - // Send request - this.beginCreate(resourceGroupName, storageSyncServiceName, serverId, parameters, options, (err, parsedResult, httpRequest, response) => { - if (err) return callback(err); - - let initialResult = new msRest.HttpOperationResponse(); - initialResult.request = httpRequest; - initialResult.response = response; - initialResult.body = response.body; - client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { - if (err) return callback(err); - - // Create Result - let result = null; - - httpRequest = pollingResult.request; - response = pollingResult.response; - let responseBody = pollingResult.body; - if (responseBody === '') responseBody = null; - - // Deserialize Response - let parsedResponse = null; - try { - parsedResponse = JSON.parse(responseBody); - result = JSON.parse(responseBody); - if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['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} parameters Body of Registered Server object. - * - * @param {string} [parameters.serverCertificate] Registered Server Certificate - * - * @param {string} [parameters.agentVersion] Registered Server Agent Version - * - * @param {string} [parameters.serverOSVersion] Registered Server OS Version - * - * @param {number} [parameters.serverManagementtErrorCode] Registered Server - * Management Error Code - * - * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat - * - * @param {string} [parameters.provisioningState] Registered Server - * Provisioning State - * - * @param {string} [parameters.serverRole] Registered Server serverRole - * - * @param {string} [parameters.clusterId] Registered Server clusterId - * - * @param {string} [parameters.clusterName] Registered Server clusterName - * - * @param {string} [parameters.serverId] Registered Server serverId - * - * @param {string} [parameters.storageSyncServiceUid] Registered Server - * storageSyncServiceUid - * - * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {string} [parameters.discoveryEndpointUri] Resource - * discoveryEndpointUri - * - * @param {string} [parameters.resourceLocation] Resource Location - * - * @param {string} [parameters.serviceLocation] Service Location - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri - * - * @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, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - if (!callback) { - throw new Error('callback cannot be null.'); - } - // Validate - try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { - throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); - } - if (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 (parameters === null || parameters === undefined) { - throw new Error('parameters cannot be null or undefined.'); - } - if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { - throw new Error('this.client.acceptLanguage must be of type string.'); - } - } catch (error) { - return callback(error); - } - - // Construct URL - let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['RegisteredServer']().mapper(); - requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(parameters, null, 2)}.`); - return callback(serializationError); - } - httpRequest.body = requestContent; - // Send Request - return client.pipeline(httpRequest, (err, response, responseBody) => { - if (err) { - return callback(err); - } - let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 202) { - let error = new Error(responseBody); - error.statusCode = response.statusCode; - error.request = msRest.stripRequest(httpRequest); - error.response = msRest.stripResponse(response); - if (responseBody === '') responseBody = null; - let parsedErrorResponse; - try { - parsedErrorResponse = JSON.parse(responseBody); - if (parsedErrorResponse) { - let internalError = null; - if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; - error.code = internalError ? internalError.code : parsedErrorResponse.code; - error.message = internalError ? internalError.message : parsedErrorResponse.message; - } - if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['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['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['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 RegisteredServers. */ -class RegisteredServers { - /** - * Create a RegisteredServers. - * @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; - this._beginCreate = _beginCreate; - 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. - * - * @param {string} resourceGroupName The name 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} parameters Body of Registered Server object. - * - * @param {string} [parameters.serverCertificate] Registered Server Certificate - * - * @param {string} [parameters.agentVersion] Registered Server Agent Version - * - * @param {string} [parameters.serverOSVersion] Registered Server OS Version - * - * @param {number} [parameters.serverManagementtErrorCode] Registered Server - * Management Error Code - * - * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat - * - * @param {string} [parameters.provisioningState] Registered Server - * Provisioning State - * - * @param {string} [parameters.serverRole] Registered Server serverRole - * - * @param {string} [parameters.clusterId] Registered Server clusterId - * - * @param {string} [parameters.clusterName] Registered Server clusterName - * - * @param {string} [parameters.serverId] Registered Server serverId - * - * @param {string} [parameters.storageSyncServiceUid] Registered Server - * storageSyncServiceUid - * - * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {string} [parameters.discoveryEndpointUri] Resource - * discoveryEndpointUri - * - * @param {string} [parameters.resourceLocation] Resource Location - * - * @param {string} [parameters.serviceLocation] Service Location - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [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, parameters, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - 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); } - 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} parameters Body of Registered Server object. - * - * @param {string} [parameters.serverCertificate] Registered Server Certificate - * - * @param {string} [parameters.agentVersion] Registered Server Agent Version - * - * @param {string} [parameters.serverOSVersion] Registered Server OS Version - * - * @param {number} [parameters.serverManagementtErrorCode] Registered Server - * Management Error Code - * - * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat - * - * @param {string} [parameters.provisioningState] Registered Server - * Provisioning State - * - * @param {string} [parameters.serverRole] Registered Server serverRole - * - * @param {string} [parameters.clusterId] Registered Server clusterId - * - * @param {string} [parameters.clusterName] Registered Server clusterName - * - * @param {string} [parameters.serverId] Registered Server serverId - * - * @param {string} [parameters.storageSyncServiceUid] Registered Server - * storageSyncServiceUid - * - * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {string} [parameters.discoveryEndpointUri] Resource - * discoveryEndpointUri - * - * @param {string} [parameters.resourceLocation] Resource Location - * - * @param {string} [parameters.serviceLocation] Service Location - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri - * - * @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, parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._create(resourceGroupName, storageSyncServiceName, serverId, parameters, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._create(resourceGroupName, storageSyncServiceName, serverId, parameters, 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} parameters Body of Registered Server object. - * - * @param {string} [parameters.serverCertificate] Registered Server Certificate - * - * @param {string} [parameters.agentVersion] Registered Server Agent Version - * - * @param {string} [parameters.serverOSVersion] Registered Server OS Version - * - * @param {number} [parameters.serverManagementtErrorCode] Registered Server - * Management Error Code - * - * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat - * - * @param {string} [parameters.provisioningState] Registered Server - * Provisioning State - * - * @param {string} [parameters.serverRole] Registered Server serverRole - * - * @param {string} [parameters.clusterId] Registered Server clusterId - * - * @param {string} [parameters.clusterName] Registered Server clusterName - * - * @param {string} [parameters.serverId] Registered Server serverId - * - * @param {string} [parameters.storageSyncServiceUid] Registered Server - * storageSyncServiceUid - * - * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {string} [parameters.discoveryEndpointUri] Resource - * discoveryEndpointUri - * - * @param {string} [parameters.resourceLocation] Resource Location - * - * @param {string} [parameters.serviceLocation] Service Location - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [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, parameters, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - 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); } - 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} parameters Body of Registered Server object. - * - * @param {string} [parameters.serverCertificate] Registered Server Certificate - * - * @param {string} [parameters.agentVersion] Registered Server Agent Version - * - * @param {string} [parameters.serverOSVersion] Registered Server OS Version - * - * @param {number} [parameters.serverManagementtErrorCode] Registered Server - * Management Error Code - * - * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat - * - * @param {string} [parameters.provisioningState] Registered Server - * Provisioning State - * - * @param {string} [parameters.serverRole] Registered Server serverRole - * - * @param {string} [parameters.clusterId] Registered Server clusterId - * - * @param {string} [parameters.clusterName] Registered Server clusterName - * - * @param {string} [parameters.serverId] Registered Server serverId - * - * @param {string} [parameters.storageSyncServiceUid] Registered Server - * storageSyncServiceUid - * - * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {string} [parameters.discoveryEndpointUri] Resource - * discoveryEndpointUri - * - * @param {string} [parameters.resourceLocation] Resource Location - * - * @param {string} [parameters.serviceLocation] Service Location - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri - * - * @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, parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._beginCreate(resourceGroupName, storageSyncServiceName, serverId, parameters, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._beginCreate(resourceGroupName, storageSyncServiceName, serverId, parameters, 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 deleted file mode 100644 index 83f1b8b717..0000000000 --- a/lib/services/storagesyncManagement/lib/operations/registeredServersGet.js +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 1181ff5576..0000000000 --- a/lib/services/storagesyncManagement/lib/operations/serverEndpointRecall.js +++ /dev/null @@ -1,450 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 020e7a6d1c..0000000000 --- a/lib/services/storagesyncManagement/lib/operations/serverEndpoints.js +++ /dev/null @@ -1,2645 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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} parameters Body of Server Endpoint object. - * - * @param {string} [parameters.serverLocalPath] Server Local path. - * - * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values - * include: 'on', 'off' - * - * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to - * be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.serverResourceId] Server Resource Id. - * - * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {object} [parameters.syncStatus] Sync Health Status - * - * @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, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - - if (!callback) { - throw new Error('callback cannot be null.'); - } - - // Send request - this.beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, parameters, options, (err, parsedResult, httpRequest, response) => { - if (err) return callback(err); - - let initialResult = new msRest.HttpOperationResponse(); - initialResult.request = httpRequest; - initialResult.response = response; - initialResult.body = response.body; - client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { - if (err) return callback(err); - - // Create Result - let result = null; - - httpRequest = pollingResult.request; - response = pollingResult.response; - let responseBody = pollingResult.body; - if (responseBody === '') responseBody = null; - - // Deserialize Response - let parsedResponse = null; - try { - parsedResponse = JSON.parse(responseBody); - result = JSON.parse(responseBody); - if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['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.parameters] Any of the properties applicable in PUT - * request. - * - * @param {string} [options.parameters.serverLocalPath] Server Local path. - * - * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible - * values include: 'on', 'off' - * - * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free - * space to be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [options.parameters.friendlyName] Friendly Name - * - * @param {string} [options.parameters.serverResourceId] Server Resource Id. - * - * @param {string} [options.parameters.provisioningState] ServerEndpoint - * Provisioning State - * - * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint - * lastWorkflowId - * - * @param {string} [options.parameters.lastOperationName] Resource Last - * Operation Name - * - * @param {object} [options.parameters.syncStatus] Sync Health Status - * - * @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['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['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); - }); - }); -} - -/** - * 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 _recallAction(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.beginRecallAction(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} parameters Body of Server Endpoint object. - * - * @param {string} [parameters.serverLocalPath] Server Local path. - * - * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values - * include: 'on', 'off' - * - * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to - * be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.serverResourceId] Server Resource Id. - * - * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {object} [parameters.syncStatus] Sync Health Status - * - * @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, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - if (!callback) { - throw new Error('callback cannot be null.'); - } - // Validate - try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { - throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); - } - if (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 (parameters === null || parameters === undefined) { - throw new Error('parameters cannot be null or undefined.'); - } - if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { - throw new Error('this.client.acceptLanguage must be of type string.'); - } - } catch (error) { - return callback(error); - } - - // Construct URL - let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['ServerEndpoint']().mapper(); - requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(parameters, null, 2)}.`); - return callback(serializationError); - } - httpRequest.body = requestContent; - // Send Request - return client.pipeline(httpRequest, (err, response, responseBody) => { - if (err) { - return callback(err); - } - let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 202) { - let error = new Error(responseBody); - error.statusCode = response.statusCode; - error.request = msRest.stripRequest(httpRequest); - error.response = msRest.stripResponse(response); - if (responseBody === '') responseBody = null; - let parsedErrorResponse; - try { - parsedErrorResponse = JSON.parse(responseBody); - if (parsedErrorResponse) { - let internalError = null; - if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; - error.code = internalError ? internalError.code : parsedErrorResponse.code; - error.message = internalError ? internalError.message : parsedErrorResponse.message; - } - if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['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['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.parameters] Any of the properties applicable in PUT - * request. - * - * @param {string} [options.parameters.serverLocalPath] Server Local path. - * - * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible - * values include: 'on', 'off' - * - * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free - * space to be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [options.parameters.friendlyName] Friendly Name - * - * @param {string} [options.parameters.serverResourceId] Server Resource Id. - * - * @param {string} [options.parameters.provisioningState] ServerEndpoint - * Provisioning State - * - * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint - * lastWorkflowId - * - * @param {string} [options.parameters.lastOperationName] Resource Last - * Operation Name - * - * @param {object} [options.parameters.syncStatus] Sync Health Status - * - * @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 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') { - 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 (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['ServerEndpoint']().mapper(); - requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(parameters, null, 2)}.`); - return callback(serializationError); - } - httpRequest.body = requestContent; - // Send Request - return client.pipeline(httpRequest, (err, response, responseBody) => { - if (err) { - return callback(err); - } - let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 202) { - let error = new Error(responseBody); - error.statusCode = response.statusCode; - error.request = msRest.stripRequest(httpRequest); - error.response = msRest.stripResponse(response); - if (responseBody === '') responseBody = null; - let parsedErrorResponse; - try { - parsedErrorResponse = JSON.parse(responseBody); - if (parsedErrorResponse) { - let internalError = null; - if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; - error.code = internalError ? internalError.code : parsedErrorResponse.code; - error.message = internalError ? internalError.message : parsedErrorResponse.message; - } - if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['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['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['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); - }); -} - -/** - * 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 _beginRecallAction(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._recallAction = _recallAction; - this._beginCreate = _beginCreate; - this._beginUpdate = _beginUpdate; - this._beginDeleteMethod = _beginDeleteMethod; - this._beginRecallAction = _beginRecallAction; - } - - /** - * 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} parameters Body of Server Endpoint object. - * - * @param {string} [parameters.serverLocalPath] Server Local path. - * - * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values - * include: 'on', 'off' - * - * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to - * be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.serverResourceId] Server Resource Id. - * - * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {object} [parameters.syncStatus] Sync Health Status - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [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, parameters, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - 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); } - 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} parameters Body of Server Endpoint object. - * - * @param {string} [parameters.serverLocalPath] Server Local path. - * - * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values - * include: 'on', 'off' - * - * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to - * be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.serverResourceId] Server Resource Id. - * - * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {object} [parameters.syncStatus] Sync Health Status - * - * @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, parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._create(resourceGroupName, 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, parameters, 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.parameters] Any of the properties applicable in PUT - * request. - * - * @param {string} [options.parameters.serverLocalPath] Server Local path. - * - * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible - * values include: 'on', 'off' - * - * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free - * space to be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [options.parameters.friendlyName] Friendly Name - * - * @param {string} [options.parameters.serverResourceId] Server Resource Id. - * - * @param {string} [options.parameters.provisioningState] ServerEndpoint - * Provisioning State - * - * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint - * lastWorkflowId - * - * @param {string} [options.parameters.lastOperationName] Resource Last - * Operation Name - * - * @param {object} [options.parameters.syncStatus] Sync Health Status - * - * @param {object} [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.parameters] Any of the properties applicable in PUT - * request. - * - * @param {string} [options.parameters.serverLocalPath] Server Local path. - * - * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible - * values include: 'on', 'off' - * - * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free - * space to be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [options.parameters.friendlyName] Friendly Name - * - * @param {string} [options.parameters.serverResourceId] Server Resource Id. - * - * @param {string} [options.parameters.provisioningState] ServerEndpoint - * Provisioning State - * - * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint - * lastWorkflowId - * - * @param {string} [options.parameters.lastOperationName] Resource Last - * Operation Name - * - * @param {object} [options.parameters.syncStatus] Sync Health Status - * - * @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); - } - } - - /** - * 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); - } - } - - /** - * 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. - */ - recallActionWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._recallAction(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. - */ - recallAction(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._recallAction(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._recallAction(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} parameters Body of Server Endpoint object. - * - * @param {string} [parameters.serverLocalPath] Server Local path. - * - * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values - * include: 'on', 'off' - * - * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to - * be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.serverResourceId] Server Resource Id. - * - * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {object} [parameters.syncStatus] Sync Health Status - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [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, parameters, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - 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); } - 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} parameters Body of Server Endpoint object. - * - * @param {string} [parameters.serverLocalPath] Server Local path. - * - * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values - * include: 'on', 'off' - * - * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to - * be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.serverResourceId] Server Resource Id. - * - * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {object} [parameters.syncStatus] Sync Health Status - * - * @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, parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._beginCreate(resourceGroupName, 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, parameters, 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.parameters] Any of the properties applicable in PUT - * request. - * - * @param {string} [options.parameters.serverLocalPath] Server Local path. - * - * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible - * values include: 'on', 'off' - * - * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free - * space to be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [options.parameters.friendlyName] Friendly Name - * - * @param {string} [options.parameters.serverResourceId] Server Resource Id. - * - * @param {string} [options.parameters.provisioningState] ServerEndpoint - * Provisioning State - * - * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint - * lastWorkflowId - * - * @param {string} [options.parameters.lastOperationName] Resource Last - * Operation Name - * - * @param {object} [options.parameters.syncStatus] Sync Health Status - * - * @param {object} [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.parameters] Any of the properties applicable in PUT - * request. - * - * @param {string} [options.parameters.serverLocalPath] Server Local path. - * - * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible - * values include: 'on', 'off' - * - * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free - * space to be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [options.parameters.friendlyName] Friendly Name - * - * @param {string} [options.parameters.serverResourceId] Server Resource Id. - * - * @param {string} [options.parameters.provisioningState] ServerEndpoint - * Provisioning State - * - * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint - * lastWorkflowId - * - * @param {string} [options.parameters.lastOperationName] Resource Last - * Operation Name - * - * @param {object} [options.parameters.syncStatus] Sync Health Status - * - * @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); - } - } - - /** - * 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. - */ - beginRecallActionWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._beginRecallAction(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. - */ - beginRecallAction(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._beginRecallAction(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._beginRecallAction(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 deleted file mode 100644 index 929d6bcaf8..0000000000 --- a/lib/services/storagesyncManagement/lib/operations/serverEndpointsGet.js +++ /dev/null @@ -1,292 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 5579a0c7f9..0000000000 --- a/lib/services/storagesyncManagement/lib/operations/storageSyncServiceByResourceGroupGet.js +++ /dev/null @@ -1,271 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 13407135c4..0000000000 --- a/lib/services/storagesyncManagement/lib/operations/storageSyncServiceGet.js +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 3dffc26791..0000000000 --- a/lib/services/storagesyncManagement/lib/operations/storageSyncServices.js +++ /dev/null @@ -1,1783 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -const msRest = require('ms-rest'); -const msRestAzure = require('ms-rest-azure'); -const WebResource = msRest.WebResource; - -/** - * Check the give namespace name availability. - * - * @param {string} locationName The desired region for the name check. - * - * @param {object} parameters Parameters to check availability of the given - * namespace name - * - * @param {string} parameters.name The name to check for availability - * - * @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 CheckNameAvailabilityResult} for more - * information. - * - * {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 _checkNameAvailability(locationName, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - if (!callback) { - throw new Error('callback cannot be null.'); - } - if (parameters === null || parameters === undefined) - { - parameters = {}; - } - // Validate - try { - if (locationName === null || locationName === undefined || typeof locationName.valueOf() !== 'string') { - throw new Error('locationName cannot be null or undefined and it must be of type string.'); - } - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (parameters === null || parameters === undefined) { - throw new Error('parameters cannot be null or undefined.'); - } - if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { - throw new Error('this.client.acceptLanguage must be of type string.'); - } - } catch (error) { - return callback(error); - } - - // Construct URL - let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/locations/{locationName}/checkNameAvailability'; - requestUrl = requestUrl.replace('{locationName}', encodeURIComponent(locationName)); - 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 = '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 (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['CheckNameAvailabilityParameters']().mapper(); - requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(parameters, null, 2)}.`); - return callback(serializationError); - } - httpRequest.body = requestContent; - // Send Request - return client.pipeline(httpRequest, (err, response, responseBody) => { - if (err) { - return callback(err); - } - let statusCode = response.statusCode; - if (statusCode !== 200) { - let error = new Error(responseBody); - error.statusCode = response.statusCode; - error.request = msRest.stripRequest(httpRequest); - error.response = msRest.stripResponse(response); - if (responseBody === '') responseBody = null; - let parsedErrorResponse; - try { - parsedErrorResponse = JSON.parse(responseBody); - if (parsedErrorResponse) { - if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; - if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; - if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; - } - if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); - error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); - } - } catch (defaultError) { - error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + - `- "${responseBody}" for the default response.`; - return callback(error); - } - return callback(error); - } - // Create Result - let result = null; - if (responseBody === '') responseBody = null; - // Deserialize Response - if (statusCode === 200) { - let parsedResponse = null; - try { - parsedResponse = JSON.parse(responseBody); - result = JSON.parse(responseBody); - if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['CheckNameAvailabilityResult']().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 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} parameters 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, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - if (!callback) { - throw new Error('callback cannot be null.'); - } - // Validate - try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { - throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); - } - if (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 (parameters === null || parameters === undefined) { - throw new Error('parameters cannot be null or undefined.'); - } - if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { - throw new Error('this.client.acceptLanguage must be of type string.'); - } - } catch (error) { - return callback(error); - } - - // Construct URL - let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['StorageSyncService']().mapper(); - requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(parameters, null, 2)}.`); - return callback(serializationError); - } - httpRequest.body = requestContent; - // Send Request - return client.pipeline(httpRequest, (err, response, responseBody) => { - if (err) { - return callback(err); - } - let statusCode = response.statusCode; - if (statusCode !== 200) { - 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['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['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['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.parameters] 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 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') { - 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 (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['StorageSyncService']().mapper(); - requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(parameters, null, 2)}.`); - return callback(serializationError); - } - httpRequest.body = requestContent; - // Send Request - return client.pipeline(httpRequest, (err, response, responseBody) => { - if (err) { - return callback(err); - } - let statusCode = response.statusCode; - if (statusCode !== 200) { - 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['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['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); - }); -} - -/** - * 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 {StorageSyncManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._checkNameAvailability = _checkNameAvailability; - this._create = _create; - this._get = _get; - this._update = _update; - this._deleteMethod = _deleteMethod; - this._listByResourceGroup = _listByResourceGroup; - this._listBySubscription = _listBySubscription; - } - - /** - * Check the give namespace name availability. - * - * @param {string} locationName The desired region for the name check. - * - * @param {object} parameters Parameters to check availability of the given - * namespace name - * - * @param {string} parameters.name The name to check for availability - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [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. - */ - checkNameAvailabilityWithHttpOperationResponse(locationName, parameters, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._checkNameAvailability(locationName, parameters, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Check the give namespace name availability. - * - * @param {string} locationName The desired region for the name check. - * - * @param {object} parameters Parameters to check availability of the given - * namespace name - * - * @param {string} parameters.name The name to check for availability - * - * @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 {CheckNameAvailabilityResult} - 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 CheckNameAvailabilityResult} for more - * information. - * - * {object} [request] - The HTTP Request object if an error did not occur. - * - * {stream} [response] - The HTTP Response stream if an error did not occur. - */ - checkNameAvailability(locationName, parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._checkNameAvailability(locationName, parameters, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._checkNameAvailability(locationName, parameters, options, optionalCallback); - } - } - - /** - * 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} parameters 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, parameters, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._create(resourceGroupName, storageSyncServiceName, parameters, 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} parameters 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, parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._create(resourceGroupName, storageSyncServiceName, parameters, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._create(resourceGroupName, storageSyncServiceName, parameters, 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.parameters] 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.parameters] 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); - } - } - - /** - * 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 deleted file mode 100644 index 5403647273..0000000000 --- a/lib/services/storagesyncManagement/lib/operations/syncGroups.js +++ /dev/null @@ -1,1081 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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['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. - * - * @param {string} resourceGroupName The name 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} parameters Sync Group Body - * - * @param {string} [parameters.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, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - if (!callback) { - throw new Error('callback cannot be null.'); - } - // Validate - try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { - throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); - } - if (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 (parameters === null || parameters === undefined) { - throw new Error('parameters cannot be null or undefined.'); - } - if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { - throw new Error('this.client.acceptLanguage must be of type string.'); - } - } catch (error) { - return callback(error); - } - - // Construct URL - let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['SyncGroup']().mapper(); - requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(parameters, null, 2)}.`); - return callback(serializationError); - } - httpRequest.body = requestContent; - // Send Request - return client.pipeline(httpRequest, (err, response, responseBody) => { - if (err) { - return callback(err); - } - let statusCode = response.statusCode; - if (statusCode !== 200) { - 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['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['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['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['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 SyncGroups. */ -class SyncGroups { - /** - * Create a SyncGroups. - * @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. - * - * @param {string} resourceGroupName The name 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} parameters Sync Group Body - * - * @param {string} [parameters.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, parameters, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - 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); } - 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} parameters Sync Group Body - * - * @param {string} [parameters.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, parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._create(resourceGroupName, storageSyncServiceName, syncGroupName, parameters, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._create(resourceGroupName, storageSyncServiceName, syncGroupName, parameters, 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 deleted file mode 100644 index 7786329153..0000000000 --- a/lib/services/storagesyncManagement/lib/operations/workflows.js +++ /dev/null @@ -1,536 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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['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['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); - }); -} - -/** - * 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 {StorageSyncManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._get = _get; - this._abort = _abort; - } - - /** - * 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); - } - } - - /** - * 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 deleted file mode 100644 index 27ea21fd0f..0000000000 --- a/lib/services/storagesyncManagement/lib/storageSyncManagementClient.d.ts +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -import { 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] - The preferred language for the response. - * - * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. - * - * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. - * - */ - constructor(credentials: ServiceClientCredentials, subscriptionId: string, baseUri?: string, options?: AzureServiceClientOptions); - - credentials: ServiceClientCredentials; - - 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 deleted file mode 100644 index 2216907265..0000000000 --- a/lib/services/storagesyncManagement/lib/storageSyncManagementClient.js +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -/* 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] - The preferred language for the response. - * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. - * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. - */ - constructor(credentials, subscriptionId, baseUri, options) { - if (credentials === null || credentials === undefined) { - throw new Error('\'credentials\' cannot be null.'); - } - if (subscriptionId === null || subscriptionId === undefined) { - throw new Error('\'subscriptionId\' cannot be null.'); - } - - if (!options) options = {}; - - super(credentials, options); - - this.apiVersion = '2018-04-02'; - 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 deleted file mode 100644 index 22c93d1e4d..0000000000 --- a/lib/services/storagesyncManagement/package.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "azure-arm-storagesync", - "author": "Microsoft Corporation", - "description": "StorageSyncManagementClient 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/storageSyncManagementClient.js", - "types": "./lib/storageSyncManagementClient.d.ts", - "homepage": "https://github.com/azure/azure-sdk-for-node/tree/master/lib/services/storagesyncManagement", - "repository": { - "type": "git", - "url": "https://github.com/azure/azure-sdk-for-node.git" - }, - "bugs": { - "url": "https://github.com/azure/azure-sdk-for-node/issues" - } -} diff --git a/lib/services/storagesyncmanagement/LICENSE.txt b/lib/services/storagesyncmanagement/LICENSE.txt deleted file mode 100644 index 5431ba98b9..0000000000 --- a/lib/services/storagesyncmanagement/LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -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 deleted file mode 100644 index 266b0589d5..0000000000 --- a/lib/services/storagesyncmanagement/README.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -uid: azure-arm-storagesync -summary: *content - ---- -# 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** - -## Features - - -## How to Install - -```bash -npm install azure-arm-storagesync -``` - -## How to use - -### Authentication, client creation and list operations as an example. - -```javascript -const msRestAzure = require("ms-rest-azure"); -const StorageSyncManagementClient = require("azure-arm-storagesync"); -msRestAzure.interactiveLogin().then((creds) => { - const subscriptionId = ""; - const client = new StorageSyncManagementClient(creds, subscriptionId); - return client.operations.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 deleted file mode 100644 index 94ee20f2c1..0000000000 --- a/lib/services/storagesyncmanagement/lib/microsoftStorageSync.d.ts +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -import { 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 deleted file mode 100644 index 8428da46f1..0000000000 --- a/lib/services/storagesyncmanagement/lib/microsoftStorageSync.js +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -/* 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 deleted file mode 100644 index a87ef97efb..0000000000 --- a/lib/services/storagesyncmanagement/lib/models/backupRequest.js +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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/checkNameAvailabilityParameters.js b/lib/services/storagesyncmanagement/lib/models/checkNameAvailabilityParameters.js deleted file mode 100644 index cad69bf476..0000000000 --- a/lib/services/storagesyncmanagement/lib/models/checkNameAvailabilityParameters.js +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -/** - * Parameters for a check name availability request. - * - */ -class CheckNameAvailabilityParameters { - /** - * Create a CheckNameAvailabilityParameters. - * @member {string} name The name to check for availability - */ - constructor() { - } - - /** - * Defines the metadata of CheckNameAvailabilityParameters - * - * @returns {object} metadata of CheckNameAvailabilityParameters - * - */ - mapper() { - return { - required: false, - serializedName: 'CheckNameAvailabilityParameters', - type: { - name: 'Composite', - className: 'CheckNameAvailabilityParameters', - modelProperties: { - name: { - required: true, - serializedName: 'name', - type: { - name: 'String' - } - }, - type: { - required: true, - isConstant: true, - serializedName: 'type', - defaultValue: 'Microsoft.StorageSync/storageSyncServices', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = CheckNameAvailabilityParameters; diff --git a/lib/services/storagesyncmanagement/lib/models/checkNameAvailabilityResult.js b/lib/services/storagesyncmanagement/lib/models/checkNameAvailabilityResult.js deleted file mode 100644 index d060e0e65d..0000000000 --- a/lib/services/storagesyncmanagement/lib/models/checkNameAvailabilityResult.js +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -/** - * The CheckNameAvailability operation response. - * - */ -class CheckNameAvailabilityResult { - /** - * Create a CheckNameAvailabilityResult. - * @member {boolean} [nameAvailable] Gets a boolean value that indicates - * whether the name is available for you to use. If true, the name is - * available. If false, the name has already been taken or invalid and cannot - * be used. - * @member {string} [reason] Gets the reason that a Storage Sync Service name - * could not be used. The Reason element is only returned if NameAvailable is - * false. Possible values include: 'Invalid', 'AlreadyExists' - * @member {string} [message] Gets an error message explaining the Reason - * value in more detail. - */ - constructor() { - } - - /** - * Defines the metadata of CheckNameAvailabilityResult - * - * @returns {object} metadata of CheckNameAvailabilityResult - * - */ - mapper() { - return { - required: false, - serializedName: 'CheckNameAvailabilityResult', - type: { - name: 'Composite', - className: 'CheckNameAvailabilityResult', - modelProperties: { - nameAvailable: { - required: false, - readOnly: true, - serializedName: 'nameAvailable', - type: { - name: 'Boolean' - } - }, - reason: { - required: false, - readOnly: true, - serializedName: 'reason', - type: { - name: 'Enum', - allowedValues: [ 'Invalid', 'AlreadyExists' ] - } - }, - message: { - required: false, - readOnly: true, - serializedName: 'message', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = CheckNameAvailabilityResult; diff --git a/lib/services/storagesyncmanagement/lib/models/cloudEndpoint.js b/lib/services/storagesyncmanagement/lib/models/cloudEndpoint.js deleted file mode 100644 index 8143070314..0000000000 --- a/lib/services/storagesyncmanagement/lib/models/cloudEndpoint.js +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 - * @member {string} [lastOperationName] Resource Last Operation Name - */ - 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, - readOnly: true, - serializedName: 'properties.backupEnabled', - type: { - name: 'Boolean' - } - }, - provisioningState: { - required: false, - serializedName: 'properties.provisioningState', - type: { - name: 'String' - } - }, - lastWorkflowId: { - required: false, - serializedName: 'properties.lastWorkflowId', - type: { - name: 'String' - } - }, - lastOperationName: { - required: false, - serializedName: 'properties.lastOperationName', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = CloudEndpoint; diff --git a/lib/services/storagesyncmanagement/lib/models/cloudEndpointArray.js b/lib/services/storagesyncmanagement/lib/models/cloudEndpointArray.js deleted file mode 100644 index 9cbf3ca987..0000000000 --- a/lib/services/storagesyncmanagement/lib/models/cloudEndpointArray.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 0754c92926..0000000000 --- a/lib/services/storagesyncmanagement/lib/models/errorDetails.js +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index bf9f0cf878..0000000000 --- a/lib/services/storagesyncmanagement/lib/models/errorModel.js +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 739d5206e3..0000000000 --- a/lib/services/storagesyncmanagement/lib/models/index.d.ts +++ /dev/null @@ -1,544 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -import { 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 StorageSyncErrorDetails 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 StorageSyncErrorDetails { - code?: string; - message?: string; - target?: string; -} - -/** - * @class - * Initializes a new instance of the StorageSyncError 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 StorageSyncError { - code?: string; - message?: string; - details?: StorageSyncErrorDetails; -} - -/** - * @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; - readonly 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 - * @member {string} [lastOperationName] Resource Last Operation Name - */ -export interface CloudEndpoint extends BaseResource { - storageAccountKey?: string; - storageAccount?: string; - storageAccountResourceId?: string; - storageAccountShareName?: string; - storageAccountTenantId?: string; - partnershipId?: string; - friendlyName?: string; - readonly backupEnabled?: boolean; - provisioningState?: string; - lastWorkflowId?: string; - lastOperationName?: 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 {string} [serverResourceId] Server Resource Id. - * @member {string} [provisioningState] ServerEndpoint Provisioning State - * @member {string} [lastWorkflowId] ServerEndpoint lastWorkflowId - * @member {string} [lastOperationName] Resource Last Operation Name - * @member {object} [syncStatus] Sync Health Status - */ -export interface ServerEndpoint extends BaseResource { - serverLocalPath?: string; - cloudTiering?: string; - volumeFreeSpacePercent?: number; - friendlyName?: string; - serverResourceId?: string; - provisioningState?: string; - lastWorkflowId?: string; - lastOperationName?: string; - syncStatus?: any; -} - -/** - * @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 - * @member {string} [lastOperationName] Resource Last Operation Name - * @member {string} [discoveryEndpointUri] Resource discoveryEndpointUri - * @member {string} [resourceLocation] Resource Location - * @member {string} [serviceLocation] Service Location - * @member {string} [friendlyName] Friendly Name - * @member {string} [managementEndpointUri] Management Endpoint Uri - */ -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; - lastOperationName?: string; - discoveryEndpointUri?: string; - resourceLocation?: string; - serviceLocation?: string; - friendlyName?: string; - managementEndpointUri?: 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 CheckNameAvailabilityParameters class. - * @constructor - * Parameters for a check name availability request. - * - * @member {string} name The name to check for availability - */ -export interface CheckNameAvailabilityParameters { - name: string; -} - -/** - * @class - * Initializes a new instance of the CheckNameAvailabilityResult class. - * @constructor - * The CheckNameAvailability operation response. - * - * @member {boolean} [nameAvailable] Gets a boolean value that indicates - * whether the name is available for you to use. If true, the name is - * available. If false, the name has already been taken or invalid and cannot - * be used. - * @member {string} [reason] Gets the reason that a Storage Sync Service name - * could not be used. The Reason element is only returned if NameAvailable is - * false. Possible values include: 'Invalid', 'AlreadyExists' - * @member {string} [message] Gets an error message explaining the Reason value - * in more detail. - */ -export interface CheckNameAvailabilityResult { - readonly nameAvailable?: boolean; - readonly reason?: string; - readonly message?: 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; - readonly 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 deleted file mode 100644 index e4896fad4c..0000000000 --- a/lib/services/storagesyncmanagement/lib/models/index.js +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -/* 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.StorageSyncErrorDetails = require('./storageSyncErrorDetails'); -exports.StorageSyncError = require('./storageSyncError'); -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.CheckNameAvailabilityParameters = require('./checkNameAvailabilityParameters'); -exports.CheckNameAvailabilityResult = require('./checkNameAvailabilityResult'); -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 deleted file mode 100644 index cf5183c004..0000000000 --- a/lib/services/storagesyncmanagement/lib/models/operationDisplayInfo.js +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 5e67311540..0000000000 --- a/lib/services/storagesyncmanagement/lib/models/operationDisplayResource.js +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index e7a1b503f7..0000000000 --- a/lib/services/storagesyncmanagement/lib/models/operationEntity.js +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -/** - * 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 deleted file mode 100644 index f2fd520020..0000000000 --- a/lib/services/storagesyncmanagement/lib/models/operationEntityListResult.js +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index dfb4c14bf1..0000000000 --- a/lib/services/storagesyncmanagement/lib/models/postBackupResponse.js +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 32be654193..0000000000 --- a/lib/services/storagesyncmanagement/lib/models/postRestoreRequest.js +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -/** - * 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 deleted file mode 100644 index 47c2c0e206..0000000000 --- a/lib/services/storagesyncmanagement/lib/models/preRestoreRequest.js +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -/** - * 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 deleted file mode 100644 index cfa338c603..0000000000 --- a/lib/services/storagesyncmanagement/lib/models/registeredServer.js +++ /dev/null @@ -1,221 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 - * @member {string} [lastOperationName] Resource Last Operation Name - * @member {string} [discoveryEndpointUri] Resource discoveryEndpointUri - * @member {string} [resourceLocation] Resource Location - * @member {string} [serviceLocation] Service Location - * @member {string} [friendlyName] Friendly Name - * @member {string} [managementEndpointUri] Management Endpoint Uri - */ - 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' - } - }, - lastOperationName: { - required: false, - serializedName: 'properties.lastOperationName', - type: { - name: 'String' - } - }, - discoveryEndpointUri: { - required: false, - serializedName: 'properties.discoveryEndpointUri', - type: { - name: 'String' - } - }, - resourceLocation: { - required: false, - serializedName: 'properties.resourceLocation', - type: { - name: 'String' - } - }, - serviceLocation: { - required: false, - serializedName: 'properties.serviceLocation', - type: { - name: 'String' - } - }, - friendlyName: { - required: false, - serializedName: 'properties.friendlyName', - type: { - name: 'String' - } - }, - managementEndpointUri: { - required: false, - serializedName: 'properties.managementEndpointUri', - type: { - name: 'String' - } - } - } - } - }; - } -} - -module.exports = RegisteredServer; diff --git a/lib/services/storagesyncmanagement/lib/models/registeredServerArray.js b/lib/services/storagesyncmanagement/lib/models/registeredServerArray.js deleted file mode 100644 index aa08378a41..0000000000 --- a/lib/services/storagesyncmanagement/lib/models/registeredServerArray.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 41b5d5e0a9..0000000000 --- a/lib/services/storagesyncmanagement/lib/models/resource.js +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index a7b26c132f..0000000000 --- a/lib/services/storagesyncmanagement/lib/models/resourcesMoveInfo.js +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 1f6eb235f7..0000000000 --- a/lib/services/storagesyncmanagement/lib/models/restoreFileSpec.js +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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, - readOnly: true, - 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 deleted file mode 100644 index 98554e6aa1..0000000000 --- a/lib/services/storagesyncmanagement/lib/models/serverEndpoint.js +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 {string} [serverResourceId] Server Resource Id. - * @member {string} [provisioningState] ServerEndpoint Provisioning State - * @member {string} [lastWorkflowId] ServerEndpoint lastWorkflowId - * @member {string} [lastOperationName] Resource Last Operation Name - * @member {object} [syncStatus] Sync Health Status - */ - 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' - } - }, - 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' - } - }, - lastOperationName: { - required: false, - serializedName: 'properties.lastOperationName', - type: { - name: 'String' - } - }, - syncStatus: { - required: false, - serializedName: 'properties.syncStatus', - type: { - name: 'Object' - } - } - } - } - }; - } -} - -module.exports = ServerEndpoint; diff --git a/lib/services/storagesyncmanagement/lib/models/serverEndpointArray.js b/lib/services/storagesyncmanagement/lib/models/serverEndpointArray.js deleted file mode 100644 index 3313291c3a..0000000000 --- a/lib/services/storagesyncmanagement/lib/models/serverEndpointArray.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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/storageSyncError.js b/lib/services/storagesyncmanagement/lib/models/storageSyncError.js deleted file mode 100644 index b185128307..0000000000 --- a/lib/services/storagesyncmanagement/lib/models/storageSyncError.js +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -/** - * 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 deleted file mode 100644 index d8fe07560a..0000000000 --- a/lib/services/storagesyncmanagement/lib/models/storageSyncErrorDetails.js +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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/storageSyncService.js b/lib/services/storagesyncmanagement/lib/models/storageSyncService.js deleted file mode 100644 index f6b979f943..0000000000 --- a/lib/services/storagesyncmanagement/lib/models/storageSyncService.js +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 1886f79e23..0000000000 --- a/lib/services/storagesyncmanagement/lib/models/storageSyncServiceArray.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index cf77bf1f05..0000000000 --- a/lib/services/storagesyncmanagement/lib/models/subscriptionState.js +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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, - readOnly: true, - 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 deleted file mode 100644 index 37720481d2..0000000000 --- a/lib/services/storagesyncmanagement/lib/models/syncGroup.js +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index cc7e29f5cc..0000000000 --- a/lib/services/storagesyncmanagement/lib/models/syncGroupArray.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 1daf584523..0000000000 --- a/lib/services/storagesyncmanagement/lib/models/trackedResource.js +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 5e92ffff83..0000000000 --- a/lib/services/storagesyncmanagement/lib/models/workflow.js +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index c2c3eb737f..0000000000 --- a/lib/services/storagesyncmanagement/lib/models/workflowArray.js +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -/** - * 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 deleted file mode 100644 index 4da18b23b5..0000000000 --- a/lib/services/storagesyncmanagement/lib/operations/abortWorkflows.js +++ /dev/null @@ -1,273 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index e8d0a62753..0000000000 --- a/lib/services/storagesyncmanagement/lib/operations/cloudEndpointPostBackup.js +++ /dev/null @@ -1,526 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 46e09ceebf..0000000000 --- a/lib/services/storagesyncmanagement/lib/operations/cloudEndpointPostRestore.js +++ /dev/null @@ -1,581 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index fc0b51f0c0..0000000000 --- a/lib/services/storagesyncmanagement/lib/operations/cloudEndpointPreBackup.js +++ /dev/null @@ -1,491 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index d1ab455b76..0000000000 --- a/lib/services/storagesyncmanagement/lib/operations/cloudEndpointPreRestore.js +++ /dev/null @@ -1,605 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index f0ba51e445..0000000000 --- a/lib/services/storagesyncmanagement/lib/operations/cloudEndpointRestoreHeatbeat.js +++ /dev/null @@ -1,283 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 3227f0ef9f..0000000000 --- a/lib/services/storagesyncmanagement/lib/operations/cloudEndpoints.js +++ /dev/null @@ -1,3986 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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} parameters Body of Cloud Endpoint resource. - * - * @param {string} [parameters.storageAccountKey] Storage Account access key. - * - * @param {string} [parameters.storageAccount] Storage Account name. - * - * @param {string} [parameters.storageAccountResourceId] Storage Account - * Resource Id - * - * @param {string} [parameters.storageAccountShareName] Storage Account Share - * name - * - * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant - * Id - * - * @param {string} [parameters.partnershipId] Partnership Id - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation 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 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, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - - if (!callback) { - throw new Error('callback cannot be null.'); - } - - // Send request - this.beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, parsedResult, httpRequest, response) => { - if (err) return callback(err); - - let initialResult = new msRest.HttpOperationResponse(); - initialResult.request = httpRequest; - initialResult.response = response; - initialResult.body = response.body; - client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { - if (err) return callback(err); - - // Create Result - let result = null; - - httpRequest = pollingResult.request; - response = pollingResult.response; - let responseBody = pollingResult.body; - if (responseBody === '') responseBody = null; - - // Deserialize Response - let parsedResponse = null; - try { - parsedResponse = JSON.parse(responseBody); - result = JSON.parse(responseBody); - if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['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['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 _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); - }); - }); -} - -/** - * 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['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['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); - }); -} - - -/** - * 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} parameters Body of Backup request. - * - * @param {string} [parameters.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 _preBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - - if (!callback) { - throw new Error('callback cannot be null.'); - } - - // Send request - this.beginPreBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, parsedResult, httpRequest, response) => { - if (err) return callback(err); - - let initialResult = new msRest.HttpOperationResponse(); - initialResult.request = httpRequest; - initialResult.response = response; - initialResult.body = response.body; - client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { - if (err) return callback(err); - - // Create Result - let result = null; - - httpRequest = pollingResult.request; - response = pollingResult.response; - let responseBody = pollingResult.body; - if (responseBody === '') responseBody = null; - - // Deserialize Response - - return callback(null, result, httpRequest, response); - }); - }); -} - - -/** - * 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} parameters Body of Backup request. - * - * @param {string} [parameters.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, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - - if (!callback) { - throw new Error('callback cannot be null.'); - } - - // Send request - this.beginPostBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, parsedResult, httpRequest, response) => { - if (err) return callback(err); - - let initialResult = new msRest.HttpOperationResponse(); - initialResult.request = httpRequest; - initialResult.response = response; - initialResult.body = response.body; - client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { - if (err) return callback(err); - - // Create Result - let result = null; - - httpRequest = pollingResult.request; - response = pollingResult.response; - let responseBody = pollingResult.body; - if (responseBody === '') responseBody = null; - - // Deserialize Response - let parsedResponse = null; - try { - parsedResponse = JSON.parse(responseBody); - result = JSON.parse(responseBody); - if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Pre Restore partition. - * - * @param {string} [parameters.replicaGroup] Pre Restore replica group. - * - * @param {string} [parameters.requestId] Pre Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Pre Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup - * metadata property bag. - * - * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec - * array. - * - * @param {number} [parameters.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, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - - if (!callback) { - throw new Error('callback cannot be null.'); - } - - // Send request - this.beginPreRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, parsedResult, httpRequest, response) => { - if (err) return callback(err); - - let initialResult = new msRest.HttpOperationResponse(); - initialResult.request = httpRequest; - initialResult.response = response; - initialResult.body = response.body; - client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { - if (err) return callback(err); - - // Create Result - let result = null; - - httpRequest = pollingResult.request; - response = pollingResult.response; - let responseBody = pollingResult.body; - if (responseBody === '') responseBody = null; - - // Deserialize Response - - return callback(null, result, httpRequest, response); - }); - }); -} - -/** - * 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 _restoreheartbeat(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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Post Restore partition. - * - * @param {string} [parameters.replicaGroup] Post Restore replica group. - * - * @param {string} [parameters.requestId] Post Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Post Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.failedFileList] Post Restore Azure failed file - * list. - * - * @param {array} [parameters.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, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - - if (!callback) { - throw new Error('callback cannot be null.'); - } - - // Send request - this.beginPostRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, parsedResult, httpRequest, response) => { - if (err) return callback(err); - - let initialResult = new msRest.HttpOperationResponse(); - initialResult.request = httpRequest; - initialResult.response = response; - initialResult.body = response.body; - client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { - if (err) return callback(err); - - // Create Result - let result = null; - - httpRequest = pollingResult.request; - response = pollingResult.response; - let responseBody = pollingResult.body; - if (responseBody === '') responseBody = null; - - // Deserialize Response - - return callback(null, result, httpRequest, response); - }); - }); -} - -/** - * 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} parameters Body of Cloud Endpoint resource. - * - * @param {string} [parameters.storageAccountKey] Storage Account access key. - * - * @param {string} [parameters.storageAccount] Storage Account name. - * - * @param {string} [parameters.storageAccountResourceId] Storage Account - * Resource Id - * - * @param {string} [parameters.storageAccountShareName] Storage Account Share - * name - * - * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant - * Id - * - * @param {string} [parameters.partnershipId] Partnership Id - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation 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 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, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - if (!callback) { - throw new Error('callback cannot be null.'); - } - // Validate - try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { - throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); - } - if (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 (parameters === null || parameters === undefined) { - throw new Error('parameters cannot be null or undefined.'); - } - if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { - throw new Error('this.client.acceptLanguage must be of type string.'); - } - } catch (error) { - return callback(error); - } - - // Construct URL - let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['CloudEndpoint']().mapper(); - requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(parameters, null, 2)}.`); - return callback(serializationError); - } - httpRequest.body = requestContent; - // Send Request - return client.pipeline(httpRequest, (err, response, responseBody) => { - if (err) { - return callback(err); - } - let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 202) { - let error = new Error(responseBody); - error.statusCode = response.statusCode; - error.request = msRest.stripRequest(httpRequest); - error.response = msRest.stripResponse(response); - if (responseBody === '') responseBody = null; - let parsedErrorResponse; - try { - parsedErrorResponse = JSON.parse(responseBody); - if (parsedErrorResponse) { - let internalError = null; - if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; - error.code = internalError ? internalError.code : parsedErrorResponse.code; - error.message = internalError ? internalError.message : parsedErrorResponse.message; - } - if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['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} parameters Body of Backup request. - * - * @param {string} [parameters.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, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - if (!callback) { - throw new Error('callback cannot be null.'); - } - // Validate - try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { - throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); - } - if (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 (parameters === null || parameters === undefined) { - throw new Error('parameters cannot be null or undefined.'); - } - if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { - throw new Error('this.client.acceptLanguage must be of type string.'); - } - } catch (error) { - return callback(error); - } - - // Construct URL - let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['BackupRequest']().mapper(); - requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(parameters, null, 2)}.`); - return callback(serializationError); - } - httpRequest.body = requestContent; - // Send Request - return client.pipeline(httpRequest, (err, response, responseBody) => { - if (err) { - return callback(err); - } - let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 202) { - let error = new Error(responseBody); - error.statusCode = response.statusCode; - error.request = msRest.stripRequest(httpRequest); - error.response = msRest.stripResponse(response); - if (responseBody === '') responseBody = null; - let parsedErrorResponse; - try { - parsedErrorResponse = JSON.parse(responseBody); - if (parsedErrorResponse) { - let internalError = null; - if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; - error.code = internalError ? internalError.code : parsedErrorResponse.code; - error.message = internalError ? internalError.message : parsedErrorResponse.message; - } - if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['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} parameters Body of Backup request. - * - * @param {string} [parameters.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, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - if (!callback) { - throw new Error('callback cannot be null.'); - } - // Validate - try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { - throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); - } - if (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 (parameters === null || parameters === undefined) { - throw new Error('parameters cannot be null or undefined.'); - } - if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { - throw new Error('this.client.acceptLanguage must be of type string.'); - } - } catch (error) { - return callback(error); - } - - // Construct URL - let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['BackupRequest']().mapper(); - requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(parameters, null, 2)}.`); - return callback(serializationError); - } - httpRequest.body = requestContent; - // Send Request - return client.pipeline(httpRequest, (err, response, responseBody) => { - if (err) { - return callback(err); - } - let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 202) { - let error = new Error(responseBody); - error.statusCode = response.statusCode; - error.request = msRest.stripRequest(httpRequest); - error.response = msRest.stripResponse(response); - if (responseBody === '') responseBody = null; - let parsedErrorResponse; - try { - parsedErrorResponse = JSON.parse(responseBody); - if (parsedErrorResponse) { - let internalError = null; - if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; - error.code = internalError ? internalError.code : parsedErrorResponse.code; - error.message = internalError ? internalError.message : parsedErrorResponse.message; - } - if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Pre Restore partition. - * - * @param {string} [parameters.replicaGroup] Pre Restore replica group. - * - * @param {string} [parameters.requestId] Pre Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Pre Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup - * metadata property bag. - * - * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec - * array. - * - * @param {number} [parameters.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, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - if (!callback) { - throw new Error('callback cannot be null.'); - } - // Validate - try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { - throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); - } - if (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 (parameters === null || parameters === undefined) { - throw new Error('parameters cannot be null or undefined.'); - } - if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { - throw new Error('this.client.acceptLanguage must be of type string.'); - } - } catch (error) { - return callback(error); - } - - // Construct URL - let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['PreRestoreRequest']().mapper(); - requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(parameters, null, 2)}.`); - return callback(serializationError); - } - httpRequest.body = requestContent; - // Send Request - return client.pipeline(httpRequest, (err, response, responseBody) => { - if (err) { - return callback(err); - } - let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 202) { - let error = new Error(responseBody); - error.statusCode = response.statusCode; - error.request = msRest.stripRequest(httpRequest); - error.response = msRest.stripResponse(response); - if (responseBody === '') responseBody = null; - let parsedErrorResponse; - try { - parsedErrorResponse = JSON.parse(responseBody); - if (parsedErrorResponse) { - let internalError = null; - if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; - error.code = internalError ? internalError.code : parsedErrorResponse.code; - error.message = internalError ? internalError.message : parsedErrorResponse.message; - } - if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Post Restore partition. - * - * @param {string} [parameters.replicaGroup] Post Restore replica group. - * - * @param {string} [parameters.requestId] Post Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Post Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.failedFileList] Post Restore Azure failed file - * list. - * - * @param {array} [parameters.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, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - if (!callback) { - throw new Error('callback cannot be null.'); - } - // Validate - try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { - throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); - } - if (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 (parameters === null || parameters === undefined) { - throw new Error('parameters cannot be null or undefined.'); - } - if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { - throw new Error('this.client.acceptLanguage must be of type string.'); - } - } catch (error) { - return callback(error); - } - - // Construct URL - let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['PostRestoreRequest']().mapper(); - requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(parameters, null, 2)}.`); - return callback(serializationError); - } - httpRequest.body = requestContent; - // Send Request - return client.pipeline(httpRequest, (err, response, responseBody) => { - if (err) { - return callback(err); - } - let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 202) { - let error = new Error(responseBody); - error.statusCode = response.statusCode; - error.request = msRest.stripRequest(httpRequest); - error.response = msRest.stripResponse(response); - if (responseBody === '') responseBody = null; - let parsedErrorResponse; - try { - parsedErrorResponse = JSON.parse(responseBody); - if (parsedErrorResponse) { - let internalError = null; - if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; - error.code = internalError ? internalError.code : parsedErrorResponse.code; - error.message = internalError ? internalError.message : parsedErrorResponse.message; - } - if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['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._restoreheartbeat = _restoreheartbeat; - 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} parameters Body of Cloud Endpoint resource. - * - * @param {string} [parameters.storageAccountKey] Storage Account access key. - * - * @param {string} [parameters.storageAccount] Storage Account name. - * - * @param {string} [parameters.storageAccountResourceId] Storage Account - * Resource Id - * - * @param {string} [parameters.storageAccountShareName] Storage Account Share - * name - * - * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant - * Id - * - * @param {string} [parameters.partnershipId] Partnership Id - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation 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, syncGroupName, cloudEndpointName, parameters, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - 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); } - 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} parameters Body of Cloud Endpoint resource. - * - * @param {string} [parameters.storageAccountKey] Storage Account access key. - * - * @param {string} [parameters.storageAccount] Storage Account name. - * - * @param {string} [parameters.storageAccountResourceId] Storage Account - * Resource Id - * - * @param {string} [parameters.storageAccountShareName] Storage Account Share - * name - * - * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant - * Id - * - * @param {string} [parameters.partnershipId] Partnership Id - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation 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 {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, parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._create(resourceGroupName, 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, parameters, 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} parameters Body of Backup request. - * - * @param {string} [parameters.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, parameters, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - 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); } - 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} parameters Body of Backup request. - * - * @param {string} [parameters.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, parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._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, parameters, 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} parameters Body of Backup request. - * - * @param {string} [parameters.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, parameters, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - 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); } - 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} parameters Body of Backup request. - * - * @param {string} [parameters.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, parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._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, parameters, 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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Pre Restore partition. - * - * @param {string} [parameters.replicaGroup] Pre Restore replica group. - * - * @param {string} [parameters.requestId] Pre Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Pre Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup - * metadata property bag. - * - * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec - * array. - * - * @param {number} [parameters.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, parameters, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - 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); } - 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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Pre Restore partition. - * - * @param {string} [parameters.replicaGroup] Pre Restore replica group. - * - * @param {string} [parameters.requestId] Pre Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Pre Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup - * metadata property bag. - * - * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec - * array. - * - * @param {number} [parameters.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, parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._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, parameters, 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. - */ - restoreheartbeatWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._restoreheartbeat(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. - */ - restoreheartbeat(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._restoreheartbeat(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._restoreheartbeat(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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Post Restore partition. - * - * @param {string} [parameters.replicaGroup] Post Restore replica group. - * - * @param {string} [parameters.requestId] Post Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Post Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.failedFileList] Post Restore Azure failed file - * list. - * - * @param {array} [parameters.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, parameters, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - 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); } - 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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Post Restore partition. - * - * @param {string} [parameters.replicaGroup] Post Restore replica group. - * - * @param {string} [parameters.requestId] Post Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Post Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.failedFileList] Post Restore Azure failed file - * list. - * - * @param {array} [parameters.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, parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._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, parameters, 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} parameters Body of Cloud Endpoint resource. - * - * @param {string} [parameters.storageAccountKey] Storage Account access key. - * - * @param {string} [parameters.storageAccount] Storage Account name. - * - * @param {string} [parameters.storageAccountResourceId] Storage Account - * Resource Id - * - * @param {string} [parameters.storageAccountShareName] Storage Account Share - * name - * - * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant - * Id - * - * @param {string} [parameters.partnershipId] Partnership Id - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation 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. - */ - 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, parameters, 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} parameters Body of Cloud Endpoint resource. - * - * @param {string} [parameters.storageAccountKey] Storage Account access key. - * - * @param {string} [parameters.storageAccount] Storage Account name. - * - * @param {string} [parameters.storageAccountResourceId] Storage Account - * Resource Id - * - * @param {string} [parameters.storageAccountShareName] Storage Account Share - * name - * - * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant - * Id - * - * @param {string} [parameters.partnershipId] Partnership Id - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation 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 {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, parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._beginCreate(resourceGroupName, 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, parameters, 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); - } - } - - /** - * 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} parameters Body of Backup request. - * - * @param {string} [parameters.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. - */ - 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, parameters, 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} parameters Body of Backup request. - * - * @param {string} [parameters.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. - */ - beginPreBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._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, parameters, 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} parameters Body of Backup request. - * - * @param {string} [parameters.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. - */ - 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, parameters, 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} parameters Body of Backup request. - * - * @param {string} [parameters.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, parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._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, parameters, 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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Pre Restore partition. - * - * @param {string} [parameters.replicaGroup] Pre Restore replica group. - * - * @param {string} [parameters.requestId] Pre Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Pre Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup - * metadata property bag. - * - * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec - * array. - * - * @param {number} [parameters.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. - */ - 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, parameters, 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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Pre Restore partition. - * - * @param {string} [parameters.replicaGroup] Pre Restore replica group. - * - * @param {string} [parameters.requestId] Pre Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Pre Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup - * metadata property bag. - * - * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec - * array. - * - * @param {number} [parameters.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. - */ - beginPreRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._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, parameters, 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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Post Restore partition. - * - * @param {string} [parameters.replicaGroup] Post Restore replica group. - * - * @param {string} [parameters.requestId] Post Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Post Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.failedFileList] Post Restore Azure failed file - * list. - * - * @param {array} [parameters.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. - */ - 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, parameters, 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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Post Restore partition. - * - * @param {string} [parameters.replicaGroup] Post Restore replica group. - * - * @param {string} [parameters.requestId] Post Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Post Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.failedFileList] Post Restore Azure failed file - * list. - * - * @param {array} [parameters.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. - */ - beginPostRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._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, parameters, options, optionalCallback); - } - } - -} - -module.exports = CloudEndpoints; diff --git a/lib/services/storagesyncmanagement/lib/operations/cloudEndpointsGet.js b/lib/services/storagesyncmanagement/lib/operations/cloudEndpointsGet.js deleted file mode 100644 index d40658182c..0000000000 --- a/lib/services/storagesyncmanagement/lib/operations/cloudEndpointsGet.js +++ /dev/null @@ -1,292 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index d51b1421ff..0000000000 --- a/lib/services/storagesyncmanagement/lib/operations/getSyncGroups.js +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 74d7e97dc0..0000000000 --- a/lib/services/storagesyncmanagement/lib/operations/index.d.ts +++ /dev/null @@ -1,3863 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. -*/ - -import { ServiceClientOptions, RequestOptions, ServiceCallback, HttpOperationResponse } from 'ms-rest'; -import * as models from '../models'; - - -/** - * @class - * Operations - * __NOTE__: An instance of this class is automatically created for an - * instance of the StorageSyncManagementClient. - */ -export interface Operations { - - - /** - * 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 StorageSyncManagementClient. - */ -export interface StorageSyncServices { - - - /** - * Check the give namespace name availability. - * - * @param {string} locationName The desired region for the name check. - * - * @param {object} parameters Parameters to check availability of the given - * namespace name - * - * @param {string} parameters.name The name to check for availability - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [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. - */ - checkNameAvailabilityWithHttpOperationResponse(locationName: string, parameters: models.CheckNameAvailabilityParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Check the give namespace name availability. - * - * @param {string} locationName The desired region for the name check. - * - * @param {object} parameters Parameters to check availability of the given - * namespace name - * - * @param {string} parameters.name The name to check for availability - * - * @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 {CheckNameAvailabilityResult} - 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. - * - * {CheckNameAvailabilityResult} [result] - The deserialized result object if an error did not occur. - * See {@link CheckNameAvailabilityResult} 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. - */ - checkNameAvailability(locationName: string, parameters: models.CheckNameAvailabilityParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - checkNameAvailability(locationName: string, parameters: models.CheckNameAvailabilityParameters, callback: ServiceCallback): void; - checkNameAvailability(locationName: string, parameters: models.CheckNameAvailabilityParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * 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} parameters 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, parameters: 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} parameters 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, 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; - - - /** - * 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.parameters] 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?: { parameters? : 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.parameters] 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?: { parameters? : models.StorageSyncService, customHeaders? : { [headerName: string]: string; } }): Promise; - update(resourceGroupName: string, storageSyncServiceName: string, callback: ServiceCallback): void; - update(resourceGroupName: string, storageSyncServiceName: string, options: { parameters? : 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; - - - /** - * 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. - */ - listByResourceGroupWithHttpOperationResponse(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. - */ - 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; - - - /** - * 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 - * SyncGroups - * __NOTE__: An instance of this class is automatically created for an - * instance of the StorageSyncManagementClient. - */ -export interface SyncGroups { - - - /** - * 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; - - - /** - * 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} parameters Sync Group Body - * - * @param {string} [parameters.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, parameters: 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} parameters Sync Group Body - * - * @param {string} [parameters.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, 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; - - - /** - * 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 StorageSyncManagementClient. - */ -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} parameters Body of Cloud Endpoint resource. - * - * @param {string} [parameters.storageAccountKey] Storage Account access key. - * - * @param {string} [parameters.storageAccount] Storage Account name. - * - * @param {string} [parameters.storageAccountResourceId] Storage Account - * Resource Id - * - * @param {string} [parameters.storageAccountShareName] Storage Account Share - * name - * - * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant - * Id - * - * @param {string} [parameters.partnershipId] Partnership Id - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation 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, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Cloud Endpoint resource. - * - * @param {string} [parameters.storageAccountKey] Storage Account access key. - * - * @param {string} [parameters.storageAccount] Storage Account name. - * - * @param {string} [parameters.storageAccountResourceId] Storage Account - * Resource Id - * - * @param {string} [parameters.storageAccountShareName] Storage Account Share - * name - * - * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant - * Id - * - * @param {string} [parameters.partnershipId] Partnership Id - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation 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 {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, 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; - - - /** - * 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; - - - /** - * 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; - - - /** - * 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} parameters Body of Backup request. - * - * @param {string} [parameters.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. - */ - preBackupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Backup request. - * - * @param {string} [parameters.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. - */ - 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; - - - /** - * 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} parameters Body of Backup request. - * - * @param {string} [parameters.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. - */ - postBackupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Backup request. - * - * @param {string} [parameters.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. - */ - 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; - - - /** - * 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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Pre Restore partition. - * - * @param {string} [parameters.replicaGroup] Pre Restore replica group. - * - * @param {string} [parameters.requestId] Pre Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Pre Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup - * metadata property bag. - * - * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec - * array. - * - * @param {number} [parameters.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. - */ - preRestoreWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Pre Restore partition. - * - * @param {string} [parameters.replicaGroup] Pre Restore replica group. - * - * @param {string} [parameters.requestId] Pre Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Pre Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup - * metadata property bag. - * - * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec - * array. - * - * @param {number} [parameters.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. - */ - 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; - - - /** - * 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. - */ - restoreheartbeatWithHttpOperationResponse(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. - */ - restoreheartbeat(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - restoreheartbeat(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, callback: ServiceCallback): void; - restoreheartbeat(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, 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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Post Restore partition. - * - * @param {string} [parameters.replicaGroup] Post Restore replica group. - * - * @param {string} [parameters.requestId] Post Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Post Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.failedFileList] Post Restore Azure failed file - * list. - * - * @param {array} [parameters.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. - */ - postRestoreWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Post Restore partition. - * - * @param {string} [parameters.replicaGroup] Post Restore replica group. - * - * @param {string} [parameters.requestId] Post Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Post Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.failedFileList] Post Restore Azure failed file - * list. - * - * @param {array} [parameters.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. - */ - 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; - - - /** - * 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} parameters Body of Cloud Endpoint resource. - * - * @param {string} [parameters.storageAccountKey] Storage Account access key. - * - * @param {string} [parameters.storageAccount] Storage Account name. - * - * @param {string} [parameters.storageAccountResourceId] Storage Account - * Resource Id - * - * @param {string} [parameters.storageAccountShareName] Storage Account Share - * name - * - * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant - * Id - * - * @param {string} [parameters.partnershipId] Partnership Id - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation 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. - */ - beginCreateWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Cloud Endpoint resource. - * - * @param {string} [parameters.storageAccountKey] Storage Account access key. - * - * @param {string} [parameters.storageAccount] Storage Account name. - * - * @param {string} [parameters.storageAccountResourceId] Storage Account - * Resource Id - * - * @param {string} [parameters.storageAccountShareName] Storage Account Share - * name - * - * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant - * Id - * - * @param {string} [parameters.partnershipId] Partnership Id - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation 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 {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, 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; - - - /** - * 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; - - - /** - * 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} parameters Body of Backup request. - * - * @param {string} [parameters.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. - */ - beginPreBackupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Backup request. - * - * @param {string} [parameters.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. - */ - 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; - - - /** - * 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} parameters Body of Backup request. - * - * @param {string} [parameters.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. - */ - beginPostBackupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Backup request. - * - * @param {string} [parameters.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. - */ - 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; - - - /** - * 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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Pre Restore partition. - * - * @param {string} [parameters.replicaGroup] Pre Restore replica group. - * - * @param {string} [parameters.requestId] Pre Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Pre Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup - * metadata property bag. - * - * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec - * array. - * - * @param {number} [parameters.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. - */ - beginPreRestoreWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Pre Restore partition. - * - * @param {string} [parameters.replicaGroup] Pre Restore replica group. - * - * @param {string} [parameters.requestId] Pre Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Pre Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup - * metadata property bag. - * - * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec - * array. - * - * @param {number} [parameters.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. - */ - 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; - - - /** - * 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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Post Restore partition. - * - * @param {string} [parameters.replicaGroup] Post Restore replica group. - * - * @param {string} [parameters.requestId] Post Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Post Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.failedFileList] Post Restore Azure failed file - * list. - * - * @param {array} [parameters.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. - */ - beginPostRestoreWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Cloud Endpoint object. - * - * @param {string} [parameters.partition] Post Restore partition. - * - * @param {string} [parameters.replicaGroup] Post Restore replica group. - * - * @param {string} [parameters.requestId] Post Restore request id. - * - * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share - * uri. - * - * @param {string} [parameters.status] Post Restore Azure status. - * - * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure - * source azure file share uri. - * - * @param {string} [parameters.failedFileList] Post Restore Azure failed file - * list. - * - * @param {array} [parameters.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. - */ - 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; -} - -/** - * @class - * ServerEndpoints - * __NOTE__: An instance of this class is automatically created for an - * instance of the StorageSyncManagementClient. - */ -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} parameters Body of Server Endpoint object. - * - * @param {string} [parameters.serverLocalPath] Server Local path. - * - * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values - * include: 'on', 'off' - * - * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to - * be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.serverResourceId] Server Resource Id. - * - * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {object} [parameters.syncStatus] Sync Health Status - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [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, parameters: 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} parameters Body of Server Endpoint object. - * - * @param {string} [parameters.serverLocalPath] Server Local path. - * - * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values - * include: 'on', 'off' - * - * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to - * be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.serverResourceId] Server Resource Id. - * - * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {object} [parameters.syncStatus] Sync Health Status - * - * @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, 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; - - - /** - * 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.parameters] Any of the properties applicable in PUT - * request. - * - * @param {string} [options.parameters.serverLocalPath] Server Local path. - * - * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible - * values include: 'on', 'off' - * - * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free - * space to be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [options.parameters.friendlyName] Friendly Name - * - * @param {string} [options.parameters.serverResourceId] Server Resource Id. - * - * @param {string} [options.parameters.provisioningState] ServerEndpoint - * Provisioning State - * - * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint - * lastWorkflowId - * - * @param {string} [options.parameters.lastOperationName] Resource Last - * Operation Name - * - * @param {object} [options.parameters.syncStatus] Sync Health Status - * - * @param {object} [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?: { parameters? : 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.parameters] Any of the properties applicable in PUT - * request. - * - * @param {string} [options.parameters.serverLocalPath] Server Local path. - * - * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible - * values include: 'on', 'off' - * - * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free - * space to be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [options.parameters.friendlyName] Friendly Name - * - * @param {string} [options.parameters.serverResourceId] Server Resource Id. - * - * @param {string} [options.parameters.provisioningState] ServerEndpoint - * Provisioning State - * - * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint - * lastWorkflowId - * - * @param {string} [options.parameters.lastOperationName] Resource Last - * Operation Name - * - * @param {object} [options.parameters.syncStatus] Sync Health Status - * - * @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?: { 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: { parameters? : 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; - - - /** - * 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; - - - /** - * 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. - */ - recallActionWithHttpOperationResponse(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. - */ - recallAction(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - recallAction(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, callback: ServiceCallback): void; - recallAction(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} parameters Body of Server Endpoint object. - * - * @param {string} [parameters.serverLocalPath] Server Local path. - * - * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values - * include: 'on', 'off' - * - * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to - * be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.serverResourceId] Server Resource Id. - * - * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {object} [parameters.syncStatus] Sync Health Status - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [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, parameters: 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} parameters Body of Server Endpoint object. - * - * @param {string} [parameters.serverLocalPath] Server Local path. - * - * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values - * include: 'on', 'off' - * - * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to - * be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.serverResourceId] Server Resource Id. - * - * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {object} [parameters.syncStatus] Sync Health Status - * - * @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, 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; - - - /** - * 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.parameters] Any of the properties applicable in PUT - * request. - * - * @param {string} [options.parameters.serverLocalPath] Server Local path. - * - * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible - * values include: 'on', 'off' - * - * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free - * space to be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [options.parameters.friendlyName] Friendly Name - * - * @param {string} [options.parameters.serverResourceId] Server Resource Id. - * - * @param {string} [options.parameters.provisioningState] ServerEndpoint - * Provisioning State - * - * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint - * lastWorkflowId - * - * @param {string} [options.parameters.lastOperationName] Resource Last - * Operation Name - * - * @param {object} [options.parameters.syncStatus] Sync Health Status - * - * @param {object} [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?: { parameters? : 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.parameters] Any of the properties applicable in PUT - * request. - * - * @param {string} [options.parameters.serverLocalPath] Server Local path. - * - * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible - * values include: 'on', 'off' - * - * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free - * space to be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [options.parameters.friendlyName] Friendly Name - * - * @param {string} [options.parameters.serverResourceId] Server Resource Id. - * - * @param {string} [options.parameters.provisioningState] ServerEndpoint - * Provisioning State - * - * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint - * lastWorkflowId - * - * @param {string} [options.parameters.lastOperationName] Resource Last - * Operation Name - * - * @param {object} [options.parameters.syncStatus] Sync Health Status - * - * @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?: { 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: { parameters? : 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; - - - /** - * 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. - */ - beginRecallActionWithHttpOperationResponse(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. - */ - beginRecallAction(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginRecallAction(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, callback: ServiceCallback): void; - beginRecallAction(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: 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 StorageSyncManagementClient. - */ -export interface RegisteredServers { - - - /** - * 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; - - - /** - * 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} parameters Body of Registered Server object. - * - * @param {string} [parameters.serverCertificate] Registered Server Certificate - * - * @param {string} [parameters.agentVersion] Registered Server Agent Version - * - * @param {string} [parameters.serverOSVersion] Registered Server OS Version - * - * @param {number} [parameters.serverManagementtErrorCode] Registered Server - * Management Error Code - * - * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat - * - * @param {string} [parameters.provisioningState] Registered Server - * Provisioning State - * - * @param {string} [parameters.serverRole] Registered Server serverRole - * - * @param {string} [parameters.clusterId] Registered Server clusterId - * - * @param {string} [parameters.clusterName] Registered Server clusterName - * - * @param {string} [parameters.serverId] Registered Server serverId - * - * @param {string} [parameters.storageSyncServiceUid] Registered Server - * storageSyncServiceUid - * - * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {string} [parameters.discoveryEndpointUri] Resource - * discoveryEndpointUri - * - * @param {string} [parameters.resourceLocation] Resource Location - * - * @param {string} [parameters.serviceLocation] Service Location - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [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, parameters: 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} parameters Body of Registered Server object. - * - * @param {string} [parameters.serverCertificate] Registered Server Certificate - * - * @param {string} [parameters.agentVersion] Registered Server Agent Version - * - * @param {string} [parameters.serverOSVersion] Registered Server OS Version - * - * @param {number} [parameters.serverManagementtErrorCode] Registered Server - * Management Error Code - * - * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat - * - * @param {string} [parameters.provisioningState] Registered Server - * Provisioning State - * - * @param {string} [parameters.serverRole] Registered Server serverRole - * - * @param {string} [parameters.clusterId] Registered Server clusterId - * - * @param {string} [parameters.clusterName] Registered Server clusterName - * - * @param {string} [parameters.serverId] Registered Server serverId - * - * @param {string} [parameters.storageSyncServiceUid] Registered Server - * storageSyncServiceUid - * - * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {string} [parameters.discoveryEndpointUri] Resource - * discoveryEndpointUri - * - * @param {string} [parameters.resourceLocation] Resource Location - * - * @param {string} [parameters.serviceLocation] Service Location - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri - * - * @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, 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; - - - /** - * 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} parameters Body of Registered Server object. - * - * @param {string} [parameters.serverCertificate] Registered Server Certificate - * - * @param {string} [parameters.agentVersion] Registered Server Agent Version - * - * @param {string} [parameters.serverOSVersion] Registered Server OS Version - * - * @param {number} [parameters.serverManagementtErrorCode] Registered Server - * Management Error Code - * - * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat - * - * @param {string} [parameters.provisioningState] Registered Server - * Provisioning State - * - * @param {string} [parameters.serverRole] Registered Server serverRole - * - * @param {string} [parameters.clusterId] Registered Server clusterId - * - * @param {string} [parameters.clusterName] Registered Server clusterName - * - * @param {string} [parameters.serverId] Registered Server serverId - * - * @param {string} [parameters.storageSyncServiceUid] Registered Server - * storageSyncServiceUid - * - * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {string} [parameters.discoveryEndpointUri] Resource - * discoveryEndpointUri - * - * @param {string} [parameters.resourceLocation] Resource Location - * - * @param {string} [parameters.serviceLocation] Service Location - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [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, parameters: 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} parameters Body of Registered Server object. - * - * @param {string} [parameters.serverCertificate] Registered Server Certificate - * - * @param {string} [parameters.agentVersion] Registered Server Agent Version - * - * @param {string} [parameters.serverOSVersion] Registered Server OS Version - * - * @param {number} [parameters.serverManagementtErrorCode] Registered Server - * Management Error Code - * - * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat - * - * @param {string} [parameters.provisioningState] Registered Server - * Provisioning State - * - * @param {string} [parameters.serverRole] Registered Server serverRole - * - * @param {string} [parameters.clusterId] Registered Server clusterId - * - * @param {string} [parameters.clusterName] Registered Server clusterName - * - * @param {string} [parameters.serverId] Registered Server serverId - * - * @param {string} [parameters.storageSyncServiceUid] Registered Server - * storageSyncServiceUid - * - * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {string} [parameters.discoveryEndpointUri] Resource - * discoveryEndpointUri - * - * @param {string} [parameters.resourceLocation] Resource Location - * - * @param {string} [parameters.serviceLocation] Service Location - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri - * - * @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, 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; - - - /** - * 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 StorageSyncManagementClient. - */ -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; - - - /** - * 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. - */ - abortWithHttpOperationResponse(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. - */ - 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 deleted file mode 100644 index 9f76216fd2..0000000000 --- a/lib/services/storagesyncmanagement/lib/operations/index.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -/* jshint latedef:false */ -/* jshint forin:false */ -/* jshint noempty:false */ - -'use strict'; - -exports.Operations = require('./operations'); -exports.StorageSyncServices = require('./storageSyncServices'); -exports.SyncGroups = require('./syncGroups'); -exports.CloudEndpoints = require('./cloudEndpoints'); -exports.ServerEndpoints = require('./serverEndpoints'); -exports.RegisteredServers = require('./registeredServers'); -exports.Workflows = require('./workflows'); diff --git a/lib/services/storagesyncmanagement/lib/operations/operationGet.js b/lib/services/storagesyncmanagement/lib/operations/operationGet.js deleted file mode 100644 index d3040bf98f..0000000000 --- a/lib/services/storagesyncmanagement/lib/operations/operationGet.js +++ /dev/null @@ -1,455 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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/operations.js b/lib/services/storagesyncmanagement/lib/operations/operations.js deleted file mode 100644 index 2fc78f7549..0000000000 --- a/lib/services/storagesyncmanagement/lib/operations/operations.js +++ /dev/null @@ -1,455 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 70c88485da..0000000000 --- a/lib/services/storagesyncmanagement/lib/operations/registeredServers.js +++ /dev/null @@ -1,1659 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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['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. - * - * @param {string} resourceGroupName The name 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['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['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} parameters Body of Registered Server object. - * - * @param {string} [parameters.serverCertificate] Registered Server Certificate - * - * @param {string} [parameters.agentVersion] Registered Server Agent Version - * - * @param {string} [parameters.serverOSVersion] Registered Server OS Version - * - * @param {number} [parameters.serverManagementtErrorCode] Registered Server - * Management Error Code - * - * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat - * - * @param {string} [parameters.provisioningState] Registered Server - * Provisioning State - * - * @param {string} [parameters.serverRole] Registered Server serverRole - * - * @param {string} [parameters.clusterId] Registered Server clusterId - * - * @param {string} [parameters.clusterName] Registered Server clusterName - * - * @param {string} [parameters.serverId] Registered Server serverId - * - * @param {string} [parameters.storageSyncServiceUid] Registered Server - * storageSyncServiceUid - * - * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {string} [parameters.discoveryEndpointUri] Resource - * discoveryEndpointUri - * - * @param {string} [parameters.resourceLocation] Resource Location - * - * @param {string} [parameters.serviceLocation] Service Location - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri - * - * @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, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - - if (!callback) { - throw new Error('callback cannot be null.'); - } - - // Send request - this.beginCreate(resourceGroupName, storageSyncServiceName, serverId, parameters, options, (err, parsedResult, httpRequest, response) => { - if (err) return callback(err); - - let initialResult = new msRest.HttpOperationResponse(); - initialResult.request = httpRequest; - initialResult.response = response; - initialResult.body = response.body; - client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { - if (err) return callback(err); - - // Create Result - let result = null; - - httpRequest = pollingResult.request; - response = pollingResult.response; - let responseBody = pollingResult.body; - if (responseBody === '') responseBody = null; - - // Deserialize Response - let parsedResponse = null; - try { - parsedResponse = JSON.parse(responseBody); - result = JSON.parse(responseBody); - if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['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} parameters Body of Registered Server object. - * - * @param {string} [parameters.serverCertificate] Registered Server Certificate - * - * @param {string} [parameters.agentVersion] Registered Server Agent Version - * - * @param {string} [parameters.serverOSVersion] Registered Server OS Version - * - * @param {number} [parameters.serverManagementtErrorCode] Registered Server - * Management Error Code - * - * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat - * - * @param {string} [parameters.provisioningState] Registered Server - * Provisioning State - * - * @param {string} [parameters.serverRole] Registered Server serverRole - * - * @param {string} [parameters.clusterId] Registered Server clusterId - * - * @param {string} [parameters.clusterName] Registered Server clusterName - * - * @param {string} [parameters.serverId] Registered Server serverId - * - * @param {string} [parameters.storageSyncServiceUid] Registered Server - * storageSyncServiceUid - * - * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {string} [parameters.discoveryEndpointUri] Resource - * discoveryEndpointUri - * - * @param {string} [parameters.resourceLocation] Resource Location - * - * @param {string} [parameters.serviceLocation] Service Location - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri - * - * @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, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - if (!callback) { - throw new Error('callback cannot be null.'); - } - // Validate - try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { - throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); - } - if (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 (parameters === null || parameters === undefined) { - throw new Error('parameters cannot be null or undefined.'); - } - if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { - throw new Error('this.client.acceptLanguage must be of type string.'); - } - } catch (error) { - return callback(error); - } - - // Construct URL - let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['RegisteredServer']().mapper(); - requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(parameters, null, 2)}.`); - return callback(serializationError); - } - httpRequest.body = requestContent; - // Send Request - return client.pipeline(httpRequest, (err, response, responseBody) => { - if (err) { - return callback(err); - } - let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 202) { - let error = new Error(responseBody); - error.statusCode = response.statusCode; - error.request = msRest.stripRequest(httpRequest); - error.response = msRest.stripResponse(response); - if (responseBody === '') responseBody = null; - let parsedErrorResponse; - try { - parsedErrorResponse = JSON.parse(responseBody); - if (parsedErrorResponse) { - let internalError = null; - if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; - error.code = internalError ? internalError.code : parsedErrorResponse.code; - error.message = internalError ? internalError.message : parsedErrorResponse.message; - } - if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['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['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['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 RegisteredServers. */ -class RegisteredServers { - /** - * Create a RegisteredServers. - * @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; - this._beginCreate = _beginCreate; - 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. - * - * @param {string} resourceGroupName The name 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} parameters Body of Registered Server object. - * - * @param {string} [parameters.serverCertificate] Registered Server Certificate - * - * @param {string} [parameters.agentVersion] Registered Server Agent Version - * - * @param {string} [parameters.serverOSVersion] Registered Server OS Version - * - * @param {number} [parameters.serverManagementtErrorCode] Registered Server - * Management Error Code - * - * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat - * - * @param {string} [parameters.provisioningState] Registered Server - * Provisioning State - * - * @param {string} [parameters.serverRole] Registered Server serverRole - * - * @param {string} [parameters.clusterId] Registered Server clusterId - * - * @param {string} [parameters.clusterName] Registered Server clusterName - * - * @param {string} [parameters.serverId] Registered Server serverId - * - * @param {string} [parameters.storageSyncServiceUid] Registered Server - * storageSyncServiceUid - * - * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {string} [parameters.discoveryEndpointUri] Resource - * discoveryEndpointUri - * - * @param {string} [parameters.resourceLocation] Resource Location - * - * @param {string} [parameters.serviceLocation] Service Location - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [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, parameters, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - 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); } - 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} parameters Body of Registered Server object. - * - * @param {string} [parameters.serverCertificate] Registered Server Certificate - * - * @param {string} [parameters.agentVersion] Registered Server Agent Version - * - * @param {string} [parameters.serverOSVersion] Registered Server OS Version - * - * @param {number} [parameters.serverManagementtErrorCode] Registered Server - * Management Error Code - * - * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat - * - * @param {string} [parameters.provisioningState] Registered Server - * Provisioning State - * - * @param {string} [parameters.serverRole] Registered Server serverRole - * - * @param {string} [parameters.clusterId] Registered Server clusterId - * - * @param {string} [parameters.clusterName] Registered Server clusterName - * - * @param {string} [parameters.serverId] Registered Server serverId - * - * @param {string} [parameters.storageSyncServiceUid] Registered Server - * storageSyncServiceUid - * - * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {string} [parameters.discoveryEndpointUri] Resource - * discoveryEndpointUri - * - * @param {string} [parameters.resourceLocation] Resource Location - * - * @param {string} [parameters.serviceLocation] Service Location - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri - * - * @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, parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._create(resourceGroupName, storageSyncServiceName, serverId, parameters, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._create(resourceGroupName, storageSyncServiceName, serverId, parameters, 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} parameters Body of Registered Server object. - * - * @param {string} [parameters.serverCertificate] Registered Server Certificate - * - * @param {string} [parameters.agentVersion] Registered Server Agent Version - * - * @param {string} [parameters.serverOSVersion] Registered Server OS Version - * - * @param {number} [parameters.serverManagementtErrorCode] Registered Server - * Management Error Code - * - * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat - * - * @param {string} [parameters.provisioningState] Registered Server - * Provisioning State - * - * @param {string} [parameters.serverRole] Registered Server serverRole - * - * @param {string} [parameters.clusterId] Registered Server clusterId - * - * @param {string} [parameters.clusterName] Registered Server clusterName - * - * @param {string} [parameters.serverId] Registered Server serverId - * - * @param {string} [parameters.storageSyncServiceUid] Registered Server - * storageSyncServiceUid - * - * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {string} [parameters.discoveryEndpointUri] Resource - * discoveryEndpointUri - * - * @param {string} [parameters.resourceLocation] Resource Location - * - * @param {string} [parameters.serviceLocation] Service Location - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [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, parameters, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - 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); } - 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} parameters Body of Registered Server object. - * - * @param {string} [parameters.serverCertificate] Registered Server Certificate - * - * @param {string} [parameters.agentVersion] Registered Server Agent Version - * - * @param {string} [parameters.serverOSVersion] Registered Server OS Version - * - * @param {number} [parameters.serverManagementtErrorCode] Registered Server - * Management Error Code - * - * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat - * - * @param {string} [parameters.provisioningState] Registered Server - * Provisioning State - * - * @param {string} [parameters.serverRole] Registered Server serverRole - * - * @param {string} [parameters.clusterId] Registered Server clusterId - * - * @param {string} [parameters.clusterName] Registered Server clusterName - * - * @param {string} [parameters.serverId] Registered Server serverId - * - * @param {string} [parameters.storageSyncServiceUid] Registered Server - * storageSyncServiceUid - * - * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {string} [parameters.discoveryEndpointUri] Resource - * discoveryEndpointUri - * - * @param {string} [parameters.resourceLocation] Resource Location - * - * @param {string} [parameters.serviceLocation] Service Location - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri - * - * @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, parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._beginCreate(resourceGroupName, storageSyncServiceName, serverId, parameters, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._beginCreate(resourceGroupName, storageSyncServiceName, serverId, parameters, 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 deleted file mode 100644 index 83f1b8b717..0000000000 --- a/lib/services/storagesyncmanagement/lib/operations/registeredServersGet.js +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 1181ff5576..0000000000 --- a/lib/services/storagesyncmanagement/lib/operations/serverEndpointRecall.js +++ /dev/null @@ -1,450 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 020e7a6d1c..0000000000 --- a/lib/services/storagesyncmanagement/lib/operations/serverEndpoints.js +++ /dev/null @@ -1,2645 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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} parameters Body of Server Endpoint object. - * - * @param {string} [parameters.serverLocalPath] Server Local path. - * - * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values - * include: 'on', 'off' - * - * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to - * be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.serverResourceId] Server Resource Id. - * - * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {object} [parameters.syncStatus] Sync Health Status - * - * @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, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - - if (!callback) { - throw new Error('callback cannot be null.'); - } - - // Send request - this.beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, parameters, options, (err, parsedResult, httpRequest, response) => { - if (err) return callback(err); - - let initialResult = new msRest.HttpOperationResponse(); - initialResult.request = httpRequest; - initialResult.response = response; - initialResult.body = response.body; - client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { - if (err) return callback(err); - - // Create Result - let result = null; - - httpRequest = pollingResult.request; - response = pollingResult.response; - let responseBody = pollingResult.body; - if (responseBody === '') responseBody = null; - - // Deserialize Response - let parsedResponse = null; - try { - parsedResponse = JSON.parse(responseBody); - result = JSON.parse(responseBody); - if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['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.parameters] Any of the properties applicable in PUT - * request. - * - * @param {string} [options.parameters.serverLocalPath] Server Local path. - * - * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible - * values include: 'on', 'off' - * - * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free - * space to be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [options.parameters.friendlyName] Friendly Name - * - * @param {string} [options.parameters.serverResourceId] Server Resource Id. - * - * @param {string} [options.parameters.provisioningState] ServerEndpoint - * Provisioning State - * - * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint - * lastWorkflowId - * - * @param {string} [options.parameters.lastOperationName] Resource Last - * Operation Name - * - * @param {object} [options.parameters.syncStatus] Sync Health Status - * - * @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['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['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); - }); - }); -} - -/** - * 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 _recallAction(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.beginRecallAction(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} parameters Body of Server Endpoint object. - * - * @param {string} [parameters.serverLocalPath] Server Local path. - * - * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values - * include: 'on', 'off' - * - * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to - * be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.serverResourceId] Server Resource Id. - * - * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {object} [parameters.syncStatus] Sync Health Status - * - * @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, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - if (!callback) { - throw new Error('callback cannot be null.'); - } - // Validate - try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { - throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); - } - if (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 (parameters === null || parameters === undefined) { - throw new Error('parameters cannot be null or undefined.'); - } - if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { - throw new Error('this.client.acceptLanguage must be of type string.'); - } - } catch (error) { - return callback(error); - } - - // Construct URL - let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['ServerEndpoint']().mapper(); - requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(parameters, null, 2)}.`); - return callback(serializationError); - } - httpRequest.body = requestContent; - // Send Request - return client.pipeline(httpRequest, (err, response, responseBody) => { - if (err) { - return callback(err); - } - let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 202) { - let error = new Error(responseBody); - error.statusCode = response.statusCode; - error.request = msRest.stripRequest(httpRequest); - error.response = msRest.stripResponse(response); - if (responseBody === '') responseBody = null; - let parsedErrorResponse; - try { - parsedErrorResponse = JSON.parse(responseBody); - if (parsedErrorResponse) { - let internalError = null; - if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; - error.code = internalError ? internalError.code : parsedErrorResponse.code; - error.message = internalError ? internalError.message : parsedErrorResponse.message; - } - if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['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['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.parameters] Any of the properties applicable in PUT - * request. - * - * @param {string} [options.parameters.serverLocalPath] Server Local path. - * - * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible - * values include: 'on', 'off' - * - * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free - * space to be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [options.parameters.friendlyName] Friendly Name - * - * @param {string} [options.parameters.serverResourceId] Server Resource Id. - * - * @param {string} [options.parameters.provisioningState] ServerEndpoint - * Provisioning State - * - * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint - * lastWorkflowId - * - * @param {string} [options.parameters.lastOperationName] Resource Last - * Operation Name - * - * @param {object} [options.parameters.syncStatus] Sync Health Status - * - * @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 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') { - 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 (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['ServerEndpoint']().mapper(); - requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(parameters, null, 2)}.`); - return callback(serializationError); - } - httpRequest.body = requestContent; - // Send Request - return client.pipeline(httpRequest, (err, response, responseBody) => { - if (err) { - return callback(err); - } - let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 202) { - let error = new Error(responseBody); - error.statusCode = response.statusCode; - error.request = msRest.stripRequest(httpRequest); - error.response = msRest.stripResponse(response); - if (responseBody === '') responseBody = null; - let parsedErrorResponse; - try { - parsedErrorResponse = JSON.parse(responseBody); - if (parsedErrorResponse) { - let internalError = null; - if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; - error.code = internalError ? internalError.code : parsedErrorResponse.code; - error.message = internalError ? internalError.message : parsedErrorResponse.message; - } - if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['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['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['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); - }); -} - -/** - * 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 _beginRecallAction(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._recallAction = _recallAction; - this._beginCreate = _beginCreate; - this._beginUpdate = _beginUpdate; - this._beginDeleteMethod = _beginDeleteMethod; - this._beginRecallAction = _beginRecallAction; - } - - /** - * 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} parameters Body of Server Endpoint object. - * - * @param {string} [parameters.serverLocalPath] Server Local path. - * - * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values - * include: 'on', 'off' - * - * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to - * be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.serverResourceId] Server Resource Id. - * - * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {object} [parameters.syncStatus] Sync Health Status - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [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, parameters, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - 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); } - 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} parameters Body of Server Endpoint object. - * - * @param {string} [parameters.serverLocalPath] Server Local path. - * - * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values - * include: 'on', 'off' - * - * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to - * be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.serverResourceId] Server Resource Id. - * - * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {object} [parameters.syncStatus] Sync Health Status - * - * @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, parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._create(resourceGroupName, 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, parameters, 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.parameters] Any of the properties applicable in PUT - * request. - * - * @param {string} [options.parameters.serverLocalPath] Server Local path. - * - * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible - * values include: 'on', 'off' - * - * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free - * space to be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [options.parameters.friendlyName] Friendly Name - * - * @param {string} [options.parameters.serverResourceId] Server Resource Id. - * - * @param {string} [options.parameters.provisioningState] ServerEndpoint - * Provisioning State - * - * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint - * lastWorkflowId - * - * @param {string} [options.parameters.lastOperationName] Resource Last - * Operation Name - * - * @param {object} [options.parameters.syncStatus] Sync Health Status - * - * @param {object} [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.parameters] Any of the properties applicable in PUT - * request. - * - * @param {string} [options.parameters.serverLocalPath] Server Local path. - * - * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible - * values include: 'on', 'off' - * - * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free - * space to be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [options.parameters.friendlyName] Friendly Name - * - * @param {string} [options.parameters.serverResourceId] Server Resource Id. - * - * @param {string} [options.parameters.provisioningState] ServerEndpoint - * Provisioning State - * - * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint - * lastWorkflowId - * - * @param {string} [options.parameters.lastOperationName] Resource Last - * Operation Name - * - * @param {object} [options.parameters.syncStatus] Sync Health Status - * - * @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); - } - } - - /** - * 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); - } - } - - /** - * 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. - */ - recallActionWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._recallAction(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. - */ - recallAction(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._recallAction(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._recallAction(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} parameters Body of Server Endpoint object. - * - * @param {string} [parameters.serverLocalPath] Server Local path. - * - * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values - * include: 'on', 'off' - * - * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to - * be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.serverResourceId] Server Resource Id. - * - * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {object} [parameters.syncStatus] Sync Health Status - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [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, parameters, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - 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); } - 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} parameters Body of Server Endpoint object. - * - * @param {string} [parameters.serverLocalPath] Server Local path. - * - * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values - * include: 'on', 'off' - * - * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to - * be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [parameters.friendlyName] Friendly Name - * - * @param {string} [parameters.serverResourceId] Server Resource Id. - * - * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning - * State - * - * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId - * - * @param {string} [parameters.lastOperationName] Resource Last Operation Name - * - * @param {object} [parameters.syncStatus] Sync Health Status - * - * @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, parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._beginCreate(resourceGroupName, 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, parameters, 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.parameters] Any of the properties applicable in PUT - * request. - * - * @param {string} [options.parameters.serverLocalPath] Server Local path. - * - * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible - * values include: 'on', 'off' - * - * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free - * space to be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [options.parameters.friendlyName] Friendly Name - * - * @param {string} [options.parameters.serverResourceId] Server Resource Id. - * - * @param {string} [options.parameters.provisioningState] ServerEndpoint - * Provisioning State - * - * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint - * lastWorkflowId - * - * @param {string} [options.parameters.lastOperationName] Resource Last - * Operation Name - * - * @param {object} [options.parameters.syncStatus] Sync Health Status - * - * @param {object} [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.parameters] Any of the properties applicable in PUT - * request. - * - * @param {string} [options.parameters.serverLocalPath] Server Local path. - * - * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible - * values include: 'on', 'off' - * - * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free - * space to be maintained by Cloud Tiering if it is enabled. - * - * @param {string} [options.parameters.friendlyName] Friendly Name - * - * @param {string} [options.parameters.serverResourceId] Server Resource Id. - * - * @param {string} [options.parameters.provisioningState] ServerEndpoint - * Provisioning State - * - * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint - * lastWorkflowId - * - * @param {string} [options.parameters.lastOperationName] Resource Last - * Operation Name - * - * @param {object} [options.parameters.syncStatus] Sync Health Status - * - * @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); - } - } - - /** - * 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. - */ - beginRecallActionWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._beginRecallAction(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. - */ - beginRecallAction(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._beginRecallAction(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._beginRecallAction(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 deleted file mode 100644 index 929d6bcaf8..0000000000 --- a/lib/services/storagesyncmanagement/lib/operations/serverEndpointsGet.js +++ /dev/null @@ -1,292 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 5579a0c7f9..0000000000 --- a/lib/services/storagesyncmanagement/lib/operations/storageSyncServiceByResourceGroupGet.js +++ /dev/null @@ -1,271 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 13407135c4..0000000000 --- a/lib/services/storagesyncmanagement/lib/operations/storageSyncServiceGet.js +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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 deleted file mode 100644 index 3dffc26791..0000000000 --- a/lib/services/storagesyncmanagement/lib/operations/storageSyncServices.js +++ /dev/null @@ -1,1783 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -const msRest = require('ms-rest'); -const msRestAzure = require('ms-rest-azure'); -const WebResource = msRest.WebResource; - -/** - * Check the give namespace name availability. - * - * @param {string} locationName The desired region for the name check. - * - * @param {object} parameters Parameters to check availability of the given - * namespace name - * - * @param {string} parameters.name The name to check for availability - * - * @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 CheckNameAvailabilityResult} for more - * information. - * - * {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 _checkNameAvailability(locationName, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - if (!callback) { - throw new Error('callback cannot be null.'); - } - if (parameters === null || parameters === undefined) - { - parameters = {}; - } - // Validate - try { - if (locationName === null || locationName === undefined || typeof locationName.valueOf() !== 'string') { - throw new Error('locationName cannot be null or undefined and it must be of type string.'); - } - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (parameters === null || parameters === undefined) { - throw new Error('parameters cannot be null or undefined.'); - } - if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { - throw new Error('this.client.acceptLanguage must be of type string.'); - } - } catch (error) { - return callback(error); - } - - // Construct URL - let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/locations/{locationName}/checkNameAvailability'; - requestUrl = requestUrl.replace('{locationName}', encodeURIComponent(locationName)); - 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 = '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 (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['CheckNameAvailabilityParameters']().mapper(); - requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(parameters, null, 2)}.`); - return callback(serializationError); - } - httpRequest.body = requestContent; - // Send Request - return client.pipeline(httpRequest, (err, response, responseBody) => { - if (err) { - return callback(err); - } - let statusCode = response.statusCode; - if (statusCode !== 200) { - let error = new Error(responseBody); - error.statusCode = response.statusCode; - error.request = msRest.stripRequest(httpRequest); - error.response = msRest.stripResponse(response); - if (responseBody === '') responseBody = null; - let parsedErrorResponse; - try { - parsedErrorResponse = JSON.parse(responseBody); - if (parsedErrorResponse) { - if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; - if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; - if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; - } - if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); - error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); - } - } catch (defaultError) { - error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + - `- "${responseBody}" for the default response.`; - return callback(error); - } - return callback(error); - } - // Create Result - let result = null; - if (responseBody === '') responseBody = null; - // Deserialize Response - if (statusCode === 200) { - let parsedResponse = null; - try { - parsedResponse = JSON.parse(responseBody); - result = JSON.parse(responseBody); - if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['CheckNameAvailabilityResult']().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 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} parameters 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, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - if (!callback) { - throw new Error('callback cannot be null.'); - } - // Validate - try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { - throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); - } - if (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 (parameters === null || parameters === undefined) { - throw new Error('parameters cannot be null or undefined.'); - } - if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { - throw new Error('this.client.acceptLanguage must be of type string.'); - } - } catch (error) { - return callback(error); - } - - // Construct URL - let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['StorageSyncService']().mapper(); - requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(parameters, null, 2)}.`); - return callback(serializationError); - } - httpRequest.body = requestContent; - // Send Request - return client.pipeline(httpRequest, (err, response, responseBody) => { - if (err) { - return callback(err); - } - let statusCode = response.statusCode; - if (statusCode !== 200) { - 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['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['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['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.parameters] 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 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') { - 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 (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['StorageSyncService']().mapper(); - requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(parameters, null, 2)}.`); - return callback(serializationError); - } - httpRequest.body = requestContent; - // Send Request - return client.pipeline(httpRequest, (err, response, responseBody) => { - if (err) { - return callback(err); - } - let statusCode = response.statusCode; - if (statusCode !== 200) { - 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['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['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); - }); -} - -/** - * 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 {StorageSyncManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._checkNameAvailability = _checkNameAvailability; - this._create = _create; - this._get = _get; - this._update = _update; - this._deleteMethod = _deleteMethod; - this._listByResourceGroup = _listByResourceGroup; - this._listBySubscription = _listBySubscription; - } - - /** - * Check the give namespace name availability. - * - * @param {string} locationName The desired region for the name check. - * - * @param {object} parameters Parameters to check availability of the given - * namespace name - * - * @param {string} parameters.name The name to check for availability - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [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. - */ - checkNameAvailabilityWithHttpOperationResponse(locationName, parameters, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._checkNameAvailability(locationName, parameters, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Check the give namespace name availability. - * - * @param {string} locationName The desired region for the name check. - * - * @param {object} parameters Parameters to check availability of the given - * namespace name - * - * @param {string} parameters.name The name to check for availability - * - * @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 {CheckNameAvailabilityResult} - 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 CheckNameAvailabilityResult} for more - * information. - * - * {object} [request] - The HTTP Request object if an error did not occur. - * - * {stream} [response] - The HTTP Response stream if an error did not occur. - */ - checkNameAvailability(locationName, parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._checkNameAvailability(locationName, parameters, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._checkNameAvailability(locationName, parameters, options, optionalCallback); - } - } - - /** - * 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} parameters 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, parameters, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._create(resourceGroupName, storageSyncServiceName, parameters, 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} parameters 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, parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._create(resourceGroupName, storageSyncServiceName, parameters, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._create(resourceGroupName, storageSyncServiceName, parameters, 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.parameters] 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.parameters] 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); - } - } - - /** - * 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 deleted file mode 100644 index 5403647273..0000000000 --- a/lib/services/storagesyncmanagement/lib/operations/syncGroups.js +++ /dev/null @@ -1,1081 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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['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. - * - * @param {string} resourceGroupName The name 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} parameters Sync Group Body - * - * @param {string} [parameters.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, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - if (!callback) { - throw new Error('callback cannot be null.'); - } - // Validate - try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { - throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); - } - if (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 (parameters === null || parameters === undefined) { - throw new Error('parameters cannot be null or undefined.'); - } - if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { - throw new Error('this.client.acceptLanguage must be of type string.'); - } - } catch (error) { - return callback(error); - } - - // Construct URL - let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['SyncGroup']().mapper(); - requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(parameters, null, 2)}.`); - return callback(serializationError); - } - httpRequest.body = requestContent; - // Send Request - return client.pipeline(httpRequest, (err, response, responseBody) => { - if (err) { - return callback(err); - } - let statusCode = response.statusCode; - if (statusCode !== 200) { - 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['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['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['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['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 SyncGroups. */ -class SyncGroups { - /** - * Create a SyncGroups. - * @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. - * - * @param {string} resourceGroupName The name 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} parameters Sync Group Body - * - * @param {string} [parameters.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, parameters, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - 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); } - 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} parameters Sync Group Body - * - * @param {string} [parameters.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, parameters, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._create(resourceGroupName, storageSyncServiceName, syncGroupName, parameters, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._create(resourceGroupName, storageSyncServiceName, syncGroupName, parameters, 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 deleted file mode 100644 index 7786329153..0000000000 --- a/lib/services/storagesyncmanagement/lib/operations/workflows.js +++ /dev/null @@ -1,536 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'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['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['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); - }); -} - -/** - * 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 {StorageSyncManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._get = _get; - this._abort = _abort; - } - - /** - * 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); - } - } - - /** - * 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 deleted file mode 100644 index 27ea21fd0f..0000000000 --- a/lib/services/storagesyncmanagement/lib/storageSyncManagementClient.d.ts +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -import { 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] - The preferred language for the response. - * - * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. - * - * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. - * - */ - constructor(credentials: ServiceClientCredentials, subscriptionId: string, baseUri?: string, options?: AzureServiceClientOptions); - - credentials: ServiceClientCredentials; - - 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 deleted file mode 100644 index 2216907265..0000000000 --- a/lib/services/storagesyncmanagement/lib/storageSyncManagementClient.js +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -/* 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] - The preferred language for the response. - * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. - * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. - */ - constructor(credentials, subscriptionId, baseUri, options) { - if (credentials === null || credentials === undefined) { - throw new Error('\'credentials\' cannot be null.'); - } - if (subscriptionId === null || subscriptionId === undefined) { - throw new Error('\'subscriptionId\' cannot be null.'); - } - - if (!options) options = {}; - - super(credentials, options); - - this.apiVersion = '2018-04-02'; - 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-lock.json b/lib/services/storagesyncmanagement/package-lock.json deleted file mode 100644 index 967c66460d..0000000000 --- a/lib/services/storagesyncmanagement/package-lock.json +++ /dev/null @@ -1,483 +0,0 @@ -{ - "name": "azure-arm-storagesync", - "version": "1.0.0", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "@types/node": { - "version": "8.10.26", - "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.26.tgz", - "integrity": "sha512-opk6bLLErLSwyVVJeSH5Ek7ZWOBSsN0JrvXTNVGLXLAXKB9xlTYajrplR44xVyMrmbut94H6uJ9jqzM/12jxkA==" - }, - "adal-node": { - "version": "0.1.28", - "resolved": "https://registry.npmjs.org/adal-node/-/adal-node-0.1.28.tgz", - "integrity": "sha1-RoxLs+u9lrEnBmn0ucuk4AZepIU=", - "requires": { - "@types/node": "^8.0.47", - "async": ">=0.6.0", - "date-utils": "*", - "jws": "3.x.x", - "request": ">= 2.52.0", - "underscore": ">= 1.3.1", - "uuid": "^3.1.0", - "xmldom": ">= 0.1.x", - "xpath.js": "~1.1.0" - } - }, - "ajv": { - "version": "5.5.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", - "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", - "requires": { - "co": "^4.6.0", - "fast-deep-equal": "^1.0.0", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.3.0" - } - }, - "asn1": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", - "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", - "requires": { - "safer-buffer": "~2.1.0" - } - }, - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" - }, - "async": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz", - "integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==", - "requires": { - "lodash": "^4.14.0" - } - }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" - }, - "aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" - }, - "aws4": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", - "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" - }, - "bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", - "optional": true, - "requires": { - "tweetnacl": "^0.14.3" - } - }, - "buffer-equal-constant-time": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", - "integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=" - }, - "caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" - }, - "co": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" - }, - "combined-stream": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", - "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", - "requires": { - "delayed-stream": "~1.0.0" - } - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" - }, - "dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", - "requires": { - "assert-plus": "^1.0.0" - } - }, - "date-utils": { - "version": "1.2.21", - "resolved": "https://registry.npmjs.org/date-utils/-/date-utils-1.2.21.tgz", - "integrity": "sha1-YfsWzcEnSzyayq/+n8ad+HIKK2Q=" - }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" - }, - "duplexer": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", - "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=" - }, - "ecc-jsbn": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", - "optional": true, - "requires": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, - "ecdsa-sig-formatter": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.10.tgz", - "integrity": "sha1-HFlQAPBKiJffuFAAiSoPTDOvhsM=", - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" - }, - "extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" - }, - "fast-deep-equal": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", - "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" - }, - "fast-json-stable-stringify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" - }, - "forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" - }, - "form-data": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", - "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "1.0.6", - "mime-types": "^2.1.12" - } - }, - "getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "requires": { - "assert-plus": "^1.0.0" - } - }, - "har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" - }, - "har-validator": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", - "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", - "requires": { - "ajv": "^5.3.0", - "har-schema": "^2.0.0" - } - }, - "http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", - "requires": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - } - }, - "is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" - }, - "is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" - }, - "is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" - }, - "isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" - }, - "jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", - "optional": true - }, - "json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" - }, - "json-schema-traverse": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", - "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" - }, - "json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" - }, - "jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.2.3", - "verror": "1.10.0" - } - }, - "jwa": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.1.6.tgz", - "integrity": "sha512-tBO/cf++BUsJkYql/kBbJroKOgHWEigTKBAjjBEmrMGYd1QMBC74Hr4Wo2zCZw6ZrVhlJPvoMrkcOnlWR/DJfw==", - "requires": { - "buffer-equal-constant-time": "1.0.1", - "ecdsa-sig-formatter": "1.0.10", - "safe-buffer": "^5.0.1" - } - }, - "jws": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/jws/-/jws-3.1.5.tgz", - "integrity": "sha512-GsCSexFADNQUr8T5HPJvayTjvPIfoyJPtLQBwn5a4WZQchcrPMPMAWcC1AzJVRDKyD6ZPROPAxgv6rfHViO4uQ==", - "requires": { - "jwa": "^1.1.5", - "safe-buffer": "^5.0.1" - } - }, - "lodash": { - "version": "4.17.10", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", - "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==" - }, - "mime-db": { - "version": "1.35.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.35.0.tgz", - "integrity": "sha512-JWT/IcCTsB0Io3AhWUMjRqucrHSPsSf2xKLaRldJVULioggvkJvggZ3VXNNSRkCddE6D+BUI4HEIZIA2OjwIvg==" - }, - "mime-types": { - "version": "2.1.19", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.19.tgz", - "integrity": "sha512-P1tKYHVSZ6uFo26mtnve4HQFE3koh1UWVkp8YUC+ESBHe945xWSoXuHHiGarDqcEZ+whpCDnlNw5LON0kLo+sw==", - "requires": { - "mime-db": "~1.35.0" - } - }, - "moment": { - "version": "2.22.2", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.22.2.tgz", - "integrity": "sha1-PCV/mDn8DpP/UxSWMiOeuQeD/2Y=" - }, - "ms-rest": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/ms-rest/-/ms-rest-2.3.6.tgz", - "integrity": "sha512-M+Lx9P7Wy4TeAk7jqPLwGS1QS1gvxF6Xo+OHv5j1g3Kcb44T/GTUuSjxTKarF6aKyeacZH1ZD++Nt7pcql7dDA==", - "requires": { - "duplexer": "^0.1.1", - "is-buffer": "^1.1.6", - "is-stream": "^1.1.0", - "moment": "^2.21.0", - "request": "^2.87.0", - "through": "^2.3.8", - "tunnel": "0.0.5", - "uuid": "^3.2.1" - } - }, - "ms-rest-azure": { - "version": "2.5.7", - "resolved": "https://registry.npmjs.org/ms-rest-azure/-/ms-rest-azure-2.5.7.tgz", - "integrity": "sha512-e4lgB0z29Dx4ufu/c+PmEAYY1WXq98GYUBkE+iRx7WsxsN04lrM3B1vj8y+B8rKt7clPUE0niqB9VovVL8zvag==", - "requires": { - "adal-node": "^0.1.28", - "async": "2.6.0", - "moment": "^2.22.2", - "ms-rest": "^2.3.2", - "uuid": "^3.2.1" - } - }, - "oauth-sign": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", - "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" - }, - "performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" - }, - "psl": { - "version": "1.1.29", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", - "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==" - }, - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" - }, - "qs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" - }, - "request": { - "version": "2.88.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", - "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", - "requires": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.0", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.4.3", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, - "sshpk": { - "version": "1.14.2", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz", - "integrity": "sha1-xvxhZIo9nE52T9P8306hBeSSupg=", - "requires": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - } - }, - "through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" - }, - "tough-cookie": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", - "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", - "requires": { - "psl": "^1.1.24", - "punycode": "^1.4.1" - } - }, - "tunnel": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.5.tgz", - "integrity": "sha512-gj5sdqherx4VZKMcBA4vewER7zdK25Td+z1npBqpbDys4eJrLx+SlYjJvq1bDXs2irkuJM5pf8ktaEQVipkrbA==" - }, - "tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", - "optional": true - }, - "underscore": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", - "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==" - }, - "uuid": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", - "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" - }, - "verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", - "requires": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, - "xmldom": { - "version": "0.1.27", - "resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.1.27.tgz", - "integrity": "sha1-1QH5ezvbQDr4757MIFcxh6rawOk=" - }, - "xpath.js": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/xpath.js/-/xpath.js-1.1.0.tgz", - "integrity": "sha512-jg+qkfS4K8E7965sqaUl8mRngXiKb3WZGfONgE18pr03FUQiuSV6G+Ej4tS55B+rIQSFEIw3phdVAQ4pPqNWfQ==" - } - } -} diff --git a/lib/services/storagesyncmanagement/package.json b/lib/services/storagesyncmanagement/package.json deleted file mode 100644 index 22c93d1e4d..0000000000 --- a/lib/services/storagesyncmanagement/package.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "azure-arm-storagesync", - "author": "Microsoft Corporation", - "description": "StorageSyncManagementClient 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/storageSyncManagementClient.js", - "types": "./lib/storageSyncManagementClient.d.ts", - "homepage": "https://github.com/azure/azure-sdk-for-node/tree/master/lib/services/storagesyncManagement", - "repository": { - "type": "git", - "url": "https://github.com/azure/azure-sdk-for-node.git" - }, - "bugs": { - "url": "https://github.com/azure/azure-sdk-for-node/issues" - } -} From fe5aa014d5c3984b11ce441f2db185c5b2099fe5 Mon Sep 17 00:00:00 2001 From: Dan Schulte Date: Mon, 20 Aug 2018 10:42:18 -0700 Subject: [PATCH 5/5] Rename storagesyncmanagement folder to storagesyncManagement --- .../storagesyncManagement/LICENSE.txt | 21 + lib/services/storagesyncManagement/README.md | 40 + .../lib/models/backupRequest.js | 52 + .../models/checkNameAvailabilityParameters.js | 61 + .../lib/models/checkNameAvailabilityResult.js | 78 + .../lib/models/cloudEndpoint.js | 137 + .../lib/models/cloudEndpointArray.js | 59 + .../lib/models/index.d.ts | 544 +++ .../storagesyncManagement/lib/models/index.js | 49 + .../lib/models/operationDisplayInfo.js | 77 + .../lib/models/operationDisplayResource.js | 76 + .../lib/models/operationEntity.js | 76 + .../lib/models/operationEntityListResult.js | 68 + .../lib/models/postBackupResponse.js | 53 + .../lib/models/postRestoreRequest.js | 117 + .../lib/models/preRestoreRequest.js | 127 + .../lib/models/registeredServer.js | 221 + .../lib/models/registeredServerArray.js | 59 + .../lib/models/resource.js | 75 + .../lib/models/resourcesMoveInfo.js | 67 + .../lib/models/restoreFileSpec.js | 61 + .../lib/models/serverEndpoint.js | 126 + .../lib/models/serverEndpointArray.js | 59 + .../lib/models/storageSyncError.js | 72 + .../lib/models/storageSyncErrorDetails.js | 68 + .../lib/models/storageSyncService.js | 66 + .../lib/models/storageSyncServiceArray.js | 59 + .../lib/models/subscriptionState.js | 70 + .../lib/models/syncGroup.js | 65 + .../lib/models/syncGroupArray.js | 59 + .../lib/models/trackedResource.js | 88 + .../lib/models/workflow.js | 90 + .../lib/models/workflowArray.js | 60 + .../lib/operations/cloudEndpoints.js | 3986 +++++++++++++++++ .../lib/operations/index.d.ts | 3863 ++++++++++++++++ .../lib/operations/index.js | 23 + .../lib/operations/operations.js | 455 ++ .../lib/operations/registeredServers.js | 1659 +++++++ .../lib/operations/serverEndpoints.js | 2645 +++++++++++ .../lib/operations/storageSyncServices.js | 1783 ++++++++ .../lib/operations/syncGroups.js | 1081 +++++ .../lib/operations/workflows.js | 536 +++ .../lib/storageSyncManagementClient.d.ts | 68 + .../lib/storageSyncManagementClient.js | 91 + .../storagesyncManagement/package-lock.json | 483 ++ .../storagesyncManagement/package.json | 25 + 46 files changed, 19698 insertions(+) create mode 100644 lib/services/storagesyncManagement/LICENSE.txt create mode 100644 lib/services/storagesyncManagement/README.md create mode 100644 lib/services/storagesyncManagement/lib/models/backupRequest.js create mode 100644 lib/services/storagesyncManagement/lib/models/checkNameAvailabilityParameters.js create mode 100644 lib/services/storagesyncManagement/lib/models/checkNameAvailabilityResult.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/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/storageSyncError.js create mode 100644 lib/services/storagesyncManagement/lib/models/storageSyncErrorDetails.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/cloudEndpoints.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/operations.js create mode 100644 lib/services/storagesyncManagement/lib/operations/registeredServers.js create mode 100644 lib/services/storagesyncManagement/lib/operations/serverEndpoints.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/lib/storageSyncManagementClient.d.ts create mode 100644 lib/services/storagesyncManagement/lib/storageSyncManagementClient.js create mode 100644 lib/services/storagesyncManagement/package-lock.json 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..a70e8cf660 --- /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..0f839bd7bd --- /dev/null +++ b/lib/services/storagesyncManagement/README.md @@ -0,0 +1,40 @@ +--- +uid: azure-arm-storagesync +summary: *content + +--- +# 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** + +## Features + + +## How to Install + +```bash +npm install azure-arm-storagesync +``` + +## How to use + +### Authentication, client creation and list operations as an example. + +```javascript +const msRestAzure = require("ms-rest-azure"); +const StorageSyncManagementClient = require("azure-arm-storagesync"); +msRestAzure.interactiveLogin().then((creds) => { + const subscriptionId = ""; + const client = new StorageSyncManagementClient(creds, subscriptionId); + return client.operations.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/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/checkNameAvailabilityParameters.js b/lib/services/storagesyncManagement/lib/models/checkNameAvailabilityParameters.js new file mode 100644 index 0000000000..cad69bf476 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/checkNameAvailabilityParameters.js @@ -0,0 +1,61 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Parameters for a check name availability request. + * + */ +class CheckNameAvailabilityParameters { + /** + * Create a CheckNameAvailabilityParameters. + * @member {string} name The name to check for availability + */ + constructor() { + } + + /** + * Defines the metadata of CheckNameAvailabilityParameters + * + * @returns {object} metadata of CheckNameAvailabilityParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'CheckNameAvailabilityParameters', + type: { + name: 'Composite', + className: 'CheckNameAvailabilityParameters', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: true, + isConstant: true, + serializedName: 'type', + defaultValue: 'Microsoft.StorageSync/storageSyncServices', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = CheckNameAvailabilityParameters; diff --git a/lib/services/storagesyncManagement/lib/models/checkNameAvailabilityResult.js b/lib/services/storagesyncManagement/lib/models/checkNameAvailabilityResult.js new file mode 100644 index 0000000000..d060e0e65d --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/checkNameAvailabilityResult.js @@ -0,0 +1,78 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The CheckNameAvailability operation response. + * + */ +class CheckNameAvailabilityResult { + /** + * Create a CheckNameAvailabilityResult. + * @member {boolean} [nameAvailable] Gets a boolean value that indicates + * whether the name is available for you to use. If true, the name is + * available. If false, the name has already been taken or invalid and cannot + * be used. + * @member {string} [reason] Gets the reason that a Storage Sync Service name + * could not be used. The Reason element is only returned if NameAvailable is + * false. Possible values include: 'Invalid', 'AlreadyExists' + * @member {string} [message] Gets an error message explaining the Reason + * value in more detail. + */ + constructor() { + } + + /** + * Defines the metadata of CheckNameAvailabilityResult + * + * @returns {object} metadata of CheckNameAvailabilityResult + * + */ + mapper() { + return { + required: false, + serializedName: 'CheckNameAvailabilityResult', + type: { + name: 'Composite', + className: 'CheckNameAvailabilityResult', + modelProperties: { + nameAvailable: { + required: false, + readOnly: true, + serializedName: 'nameAvailable', + type: { + name: 'Boolean' + } + }, + reason: { + required: false, + readOnly: true, + serializedName: 'reason', + type: { + name: 'Enum', + allowedValues: [ 'Invalid', 'AlreadyExists' ] + } + }, + message: { + required: false, + readOnly: true, + serializedName: 'message', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = CheckNameAvailabilityResult; diff --git a/lib/services/storagesyncManagement/lib/models/cloudEndpoint.js b/lib/services/storagesyncManagement/lib/models/cloudEndpoint.js new file mode 100644 index 0000000000..8143070314 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/cloudEndpoint.js @@ -0,0 +1,137 @@ +/* + * 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 + * @member {string} [lastOperationName] Resource Last Operation Name + */ + 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, + readOnly: true, + serializedName: 'properties.backupEnabled', + type: { + name: 'Boolean' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + lastWorkflowId: { + required: false, + serializedName: 'properties.lastWorkflowId', + type: { + name: 'String' + } + }, + lastOperationName: { + required: false, + serializedName: 'properties.lastOperationName', + 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/index.d.ts b/lib/services/storagesyncManagement/lib/models/index.d.ts new file mode 100644 index 0000000000..739d5206e3 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/index.d.ts @@ -0,0 +1,544 @@ +/* + * 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 StorageSyncErrorDetails 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 StorageSyncErrorDetails { + code?: string; + message?: string; + target?: string; +} + +/** + * @class + * Initializes a new instance of the StorageSyncError 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 StorageSyncError { + code?: string; + message?: string; + details?: StorageSyncErrorDetails; +} + +/** + * @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; + readonly 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 + * @member {string} [lastOperationName] Resource Last Operation Name + */ +export interface CloudEndpoint extends BaseResource { + storageAccountKey?: string; + storageAccount?: string; + storageAccountResourceId?: string; + storageAccountShareName?: string; + storageAccountTenantId?: string; + partnershipId?: string; + friendlyName?: string; + readonly backupEnabled?: boolean; + provisioningState?: string; + lastWorkflowId?: string; + lastOperationName?: 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 {string} [serverResourceId] Server Resource Id. + * @member {string} [provisioningState] ServerEndpoint Provisioning State + * @member {string} [lastWorkflowId] ServerEndpoint lastWorkflowId + * @member {string} [lastOperationName] Resource Last Operation Name + * @member {object} [syncStatus] Sync Health Status + */ +export interface ServerEndpoint extends BaseResource { + serverLocalPath?: string; + cloudTiering?: string; + volumeFreeSpacePercent?: number; + friendlyName?: string; + serverResourceId?: string; + provisioningState?: string; + lastWorkflowId?: string; + lastOperationName?: string; + syncStatus?: any; +} + +/** + * @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 + * @member {string} [lastOperationName] Resource Last Operation Name + * @member {string} [discoveryEndpointUri] Resource discoveryEndpointUri + * @member {string} [resourceLocation] Resource Location + * @member {string} [serviceLocation] Service Location + * @member {string} [friendlyName] Friendly Name + * @member {string} [managementEndpointUri] Management Endpoint Uri + */ +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; + lastOperationName?: string; + discoveryEndpointUri?: string; + resourceLocation?: string; + serviceLocation?: string; + friendlyName?: string; + managementEndpointUri?: 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 CheckNameAvailabilityParameters class. + * @constructor + * Parameters for a check name availability request. + * + * @member {string} name The name to check for availability + */ +export interface CheckNameAvailabilityParameters { + name: string; +} + +/** + * @class + * Initializes a new instance of the CheckNameAvailabilityResult class. + * @constructor + * The CheckNameAvailability operation response. + * + * @member {boolean} [nameAvailable] Gets a boolean value that indicates + * whether the name is available for you to use. If true, the name is + * available. If false, the name has already been taken or invalid and cannot + * be used. + * @member {string} [reason] Gets the reason that a Storage Sync Service name + * could not be used. The Reason element is only returned if NameAvailable is + * false. Possible values include: 'Invalid', 'AlreadyExists' + * @member {string} [message] Gets an error message explaining the Reason value + * in more detail. + */ +export interface CheckNameAvailabilityResult { + readonly nameAvailable?: boolean; + readonly reason?: string; + readonly message?: 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; + readonly 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..e4896fad4c --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/index.js @@ -0,0 +1,49 @@ +/* + * 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.StorageSyncErrorDetails = require('./storageSyncErrorDetails'); +exports.StorageSyncError = require('./storageSyncError'); +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.CheckNameAvailabilityParameters = require('./checkNameAvailabilityParameters'); +exports.CheckNameAvailabilityResult = require('./checkNameAvailabilityResult'); +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..e7a1b503f7 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/operationEntity.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'; + +/** + * 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..32be654193 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/postRestoreRequest.js @@ -0,0 +1,117 @@ +/* + * 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 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..47c2c0e206 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/preRestoreRequest.js @@ -0,0 +1,127 @@ +/* + * 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'; + +/** + * 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..cfa338c603 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/registeredServer.js @@ -0,0 +1,221 @@ +/* + * 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 + * @member {string} [lastOperationName] Resource Last Operation Name + * @member {string} [discoveryEndpointUri] Resource discoveryEndpointUri + * @member {string} [resourceLocation] Resource Location + * @member {string} [serviceLocation] Service Location + * @member {string} [friendlyName] Friendly Name + * @member {string} [managementEndpointUri] Management Endpoint Uri + */ + 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' + } + }, + lastOperationName: { + required: false, + serializedName: 'properties.lastOperationName', + type: { + name: 'String' + } + }, + discoveryEndpointUri: { + required: false, + serializedName: 'properties.discoveryEndpointUri', + type: { + name: 'String' + } + }, + resourceLocation: { + required: false, + serializedName: 'properties.resourceLocation', + type: { + name: 'String' + } + }, + serviceLocation: { + required: false, + serializedName: 'properties.serviceLocation', + type: { + name: 'String' + } + }, + friendlyName: { + required: false, + serializedName: 'properties.friendlyName', + type: { + name: 'String' + } + }, + managementEndpointUri: { + required: false, + serializedName: 'properties.managementEndpointUri', + 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..1f6eb235f7 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/restoreFileSpec.js @@ -0,0 +1,61 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * 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, + readOnly: true, + 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..98554e6aa1 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/serverEndpoint.js @@ -0,0 +1,126 @@ +/* + * 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 {string} [serverResourceId] Server Resource Id. + * @member {string} [provisioningState] ServerEndpoint Provisioning State + * @member {string} [lastWorkflowId] ServerEndpoint lastWorkflowId + * @member {string} [lastOperationName] Resource Last Operation Name + * @member {object} [syncStatus] Sync Health Status + */ + 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' + } + }, + 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' + } + }, + lastOperationName: { + required: false, + serializedName: 'properties.lastOperationName', + type: { + name: 'String' + } + }, + syncStatus: { + required: false, + serializedName: 'properties.syncStatus', + type: { + name: 'Object' + } + } + } + } + }; + } +} + +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/storageSyncError.js b/lib/services/storagesyncManagement/lib/models/storageSyncError.js new file mode 100644 index 0000000000..b185128307 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/storageSyncError.js @@ -0,0 +1,72 @@ +/* + * 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 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/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..cf77bf1f05 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/subscriptionState.js @@ -0,0 +1,70 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * 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, + readOnly: true, + 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..c2c3eb737f --- /dev/null +++ b/lib/services/storagesyncManagement/lib/models/workflowArray.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'; + +/** + * 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/cloudEndpoints.js b/lib/services/storagesyncManagement/lib/operations/cloudEndpoints.js new file mode 100644 index 0000000000..3227f0ef9f --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/cloudEndpoints.js @@ -0,0 +1,3986 @@ +/* + * 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} parameters Body of Cloud Endpoint resource. + * + * @param {string} [parameters.storageAccountKey] Storage Account access key. + * + * @param {string} [parameters.storageAccount] Storage Account name. + * + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id + * + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name + * + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id + * + * @param {string} [parameters.partnershipId] Partnership Id + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation 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 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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['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['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 _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); + }); + }); +} + +/** + * 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['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['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); + }); +} + + +/** + * 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} parameters Body of Backup request. + * + * @param {string} [parameters.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 _preBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginPreBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * 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} parameters Body of Backup request. + * + * @param {string} [parameters.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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginPostBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Pre Restore partition. + * + * @param {string} [parameters.replicaGroup] Pre Restore replica group. + * + * @param {string} [parameters.requestId] Pre Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Pre Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. + * + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. + * + * @param {number} [parameters.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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginPreRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * 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 _restoreheartbeat(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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Post Restore partition. + * + * @param {string} [parameters.replicaGroup] Post Restore replica group. + * + * @param {string} [parameters.requestId] Post Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Post Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. + * + * @param {array} [parameters.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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginPostRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * 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} parameters Body of Cloud Endpoint resource. + * + * @param {string} [parameters.storageAccountKey] Storage Account access key. + * + * @param {string} [parameters.storageAccount] Storage Account name. + * + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id + * + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name + * + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id + * + * @param {string} [parameters.partnershipId] Partnership Id + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation 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 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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['CloudEndpoint']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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} parameters Body of Backup request. + * + * @param {string} [parameters.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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['BackupRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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} parameters Body of Backup request. + * + * @param {string} [parameters.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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['BackupRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Pre Restore partition. + * + * @param {string} [parameters.replicaGroup] Pre Restore replica group. + * + * @param {string} [parameters.requestId] Pre Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Pre Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. + * + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. + * + * @param {number} [parameters.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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['PreRestoreRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Post Restore partition. + * + * @param {string} [parameters.replicaGroup] Post Restore replica group. + * + * @param {string} [parameters.requestId] Post Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Post Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. + * + * @param {array} [parameters.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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['PostRestoreRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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._restoreheartbeat = _restoreheartbeat; + 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} parameters Body of Cloud Endpoint resource. + * + * @param {string} [parameters.storageAccountKey] Storage Account access key. + * + * @param {string} [parameters.storageAccount] Storage Account name. + * + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id + * + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name + * + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id + * + * @param {string} [parameters.partnershipId] Partnership Id + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation 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, syncGroupName, cloudEndpointName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + 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); } + 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} parameters Body of Cloud Endpoint resource. + * + * @param {string} [parameters.storageAccountKey] Storage Account access key. + * + * @param {string} [parameters.storageAccount] Storage Account name. + * + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id + * + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name + * + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id + * + * @param {string} [parameters.partnershipId] Partnership Id + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation 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 {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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._create(resourceGroupName, 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, parameters, 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} parameters Body of Backup request. + * + * @param {string} [parameters.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, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + 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); } + 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} parameters Body of Backup request. + * + * @param {string} [parameters.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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._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, parameters, 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} parameters Body of Backup request. + * + * @param {string} [parameters.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, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + 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); } + 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} parameters Body of Backup request. + * + * @param {string} [parameters.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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._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, parameters, 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Pre Restore partition. + * + * @param {string} [parameters.replicaGroup] Pre Restore replica group. + * + * @param {string} [parameters.requestId] Pre Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Pre Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. + * + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. + * + * @param {number} [parameters.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, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + 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); } + 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Pre Restore partition. + * + * @param {string} [parameters.replicaGroup] Pre Restore replica group. + * + * @param {string} [parameters.requestId] Pre Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Pre Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. + * + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. + * + * @param {number} [parameters.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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._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, parameters, 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. + */ + restoreheartbeatWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._restoreheartbeat(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. + */ + restoreheartbeat(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._restoreheartbeat(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._restoreheartbeat(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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Post Restore partition. + * + * @param {string} [parameters.replicaGroup] Post Restore replica group. + * + * @param {string} [parameters.requestId] Post Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Post Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. + * + * @param {array} [parameters.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, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + 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); } + 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Post Restore partition. + * + * @param {string} [parameters.replicaGroup] Post Restore replica group. + * + * @param {string} [parameters.requestId] Post Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Post Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. + * + * @param {array} [parameters.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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._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, parameters, 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} parameters Body of Cloud Endpoint resource. + * + * @param {string} [parameters.storageAccountKey] Storage Account access key. + * + * @param {string} [parameters.storageAccount] Storage Account name. + * + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id + * + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name + * + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id + * + * @param {string} [parameters.partnershipId] Partnership Id + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation 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. + */ + 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, parameters, 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} parameters Body of Cloud Endpoint resource. + * + * @param {string} [parameters.storageAccountKey] Storage Account access key. + * + * @param {string} [parameters.storageAccount] Storage Account name. + * + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id + * + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name + * + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id + * + * @param {string} [parameters.partnershipId] Partnership Id + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation 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 {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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreate(resourceGroupName, 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, parameters, 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); + } + } + + /** + * 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} parameters Body of Backup request. + * + * @param {string} [parameters.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. + */ + 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, parameters, 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} parameters Body of Backup request. + * + * @param {string} [parameters.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. + */ + beginPreBackup(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._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, parameters, 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} parameters Body of Backup request. + * + * @param {string} [parameters.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. + */ + 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, parameters, 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} parameters Body of Backup request. + * + * @param {string} [parameters.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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._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, parameters, 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Pre Restore partition. + * + * @param {string} [parameters.replicaGroup] Pre Restore replica group. + * + * @param {string} [parameters.requestId] Pre Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Pre Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. + * + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. + * + * @param {number} [parameters.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. + */ + 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, parameters, 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Pre Restore partition. + * + * @param {string} [parameters.replicaGroup] Pre Restore replica group. + * + * @param {string} [parameters.requestId] Pre Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Pre Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. + * + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. + * + * @param {number} [parameters.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. + */ + beginPreRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._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, parameters, 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Post Restore partition. + * + * @param {string} [parameters.replicaGroup] Post Restore replica group. + * + * @param {string} [parameters.requestId] Post Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Post Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. + * + * @param {array} [parameters.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. + */ + 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, parameters, 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Post Restore partition. + * + * @param {string} [parameters.replicaGroup] Post Restore replica group. + * + * @param {string} [parameters.requestId] Post Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Post Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. + * + * @param {array} [parameters.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. + */ + beginPostRestore(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._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, parameters, options, optionalCallback); + } + } + +} + +module.exports = CloudEndpoints; 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..74d7e97dc0 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/index.d.ts @@ -0,0 +1,3863 @@ +/* + * 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 + * Operations + * __NOTE__: An instance of this class is automatically created for an + * instance of the StorageSyncManagementClient. + */ +export interface Operations { + + + /** + * 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 StorageSyncManagementClient. + */ +export interface StorageSyncServices { + + + /** + * Check the give namespace name availability. + * + * @param {string} locationName The desired region for the name check. + * + * @param {object} parameters Parameters to check availability of the given + * namespace name + * + * @param {string} parameters.name The name to check for availability + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + checkNameAvailabilityWithHttpOperationResponse(locationName: string, parameters: models.CheckNameAvailabilityParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Check the give namespace name availability. + * + * @param {string} locationName The desired region for the name check. + * + * @param {object} parameters Parameters to check availability of the given + * namespace name + * + * @param {string} parameters.name The name to check for availability + * + * @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 {CheckNameAvailabilityResult} - 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. + * + * {CheckNameAvailabilityResult} [result] - The deserialized result object if an error did not occur. + * See {@link CheckNameAvailabilityResult} 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. + */ + checkNameAvailability(locationName: string, parameters: models.CheckNameAvailabilityParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + checkNameAvailability(locationName: string, parameters: models.CheckNameAvailabilityParameters, callback: ServiceCallback): void; + checkNameAvailability(locationName: string, parameters: models.CheckNameAvailabilityParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * 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} parameters 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, parameters: 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} parameters 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, 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; + + + /** + * 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.parameters] 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?: { parameters? : 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.parameters] 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?: { parameters? : models.StorageSyncService, customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, storageSyncServiceName: string, callback: ServiceCallback): void; + update(resourceGroupName: string, storageSyncServiceName: string, options: { parameters? : 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; + + + /** + * 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. + */ + listByResourceGroupWithHttpOperationResponse(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. + */ + 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; + + + /** + * 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 + * SyncGroups + * __NOTE__: An instance of this class is automatically created for an + * instance of the StorageSyncManagementClient. + */ +export interface SyncGroups { + + + /** + * 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; + + + /** + * 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} parameters Sync Group Body + * + * @param {string} [parameters.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, parameters: 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} parameters Sync Group Body + * + * @param {string} [parameters.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, 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; + + + /** + * 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 StorageSyncManagementClient. + */ +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} parameters Body of Cloud Endpoint resource. + * + * @param {string} [parameters.storageAccountKey] Storage Account access key. + * + * @param {string} [parameters.storageAccount] Storage Account name. + * + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id + * + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name + * + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id + * + * @param {string} [parameters.partnershipId] Partnership Id + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation 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, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Cloud Endpoint resource. + * + * @param {string} [parameters.storageAccountKey] Storage Account access key. + * + * @param {string} [parameters.storageAccount] Storage Account name. + * + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id + * + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name + * + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id + * + * @param {string} [parameters.partnershipId] Partnership Id + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation 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 {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, 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; + + + /** + * 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; + + + /** + * 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; + + + /** + * 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} parameters Body of Backup request. + * + * @param {string} [parameters.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. + */ + preBackupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Backup request. + * + * @param {string} [parameters.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. + */ + 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; + + + /** + * 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} parameters Body of Backup request. + * + * @param {string} [parameters.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. + */ + postBackupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Backup request. + * + * @param {string} [parameters.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. + */ + 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; + + + /** + * 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Pre Restore partition. + * + * @param {string} [parameters.replicaGroup] Pre Restore replica group. + * + * @param {string} [parameters.requestId] Pre Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Pre Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. + * + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. + * + * @param {number} [parameters.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. + */ + preRestoreWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Pre Restore partition. + * + * @param {string} [parameters.replicaGroup] Pre Restore replica group. + * + * @param {string} [parameters.requestId] Pre Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Pre Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. + * + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. + * + * @param {number} [parameters.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. + */ + 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; + + + /** + * 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. + */ + restoreheartbeatWithHttpOperationResponse(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. + */ + restoreheartbeat(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + restoreheartbeat(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, callback: ServiceCallback): void; + restoreheartbeat(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Post Restore partition. + * + * @param {string} [parameters.replicaGroup] Post Restore replica group. + * + * @param {string} [parameters.requestId] Post Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Post Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. + * + * @param {array} [parameters.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. + */ + postRestoreWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Post Restore partition. + * + * @param {string} [parameters.replicaGroup] Post Restore replica group. + * + * @param {string} [parameters.requestId] Post Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Post Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. + * + * @param {array} [parameters.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. + */ + 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; + + + /** + * 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} parameters Body of Cloud Endpoint resource. + * + * @param {string} [parameters.storageAccountKey] Storage Account access key. + * + * @param {string} [parameters.storageAccount] Storage Account name. + * + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id + * + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name + * + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id + * + * @param {string} [parameters.partnershipId] Partnership Id + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation 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. + */ + beginCreateWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Cloud Endpoint resource. + * + * @param {string} [parameters.storageAccountKey] Storage Account access key. + * + * @param {string} [parameters.storageAccount] Storage Account name. + * + * @param {string} [parameters.storageAccountResourceId] Storage Account + * Resource Id + * + * @param {string} [parameters.storageAccountShareName] Storage Account Share + * name + * + * @param {string} [parameters.storageAccountTenantId] Storage Account Tenant + * Id + * + * @param {string} [parameters.partnershipId] Partnership Id + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.provisioningState] CloudEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] CloudEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation 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 {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, 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; + + + /** + * 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; + + + /** + * 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} parameters Body of Backup request. + * + * @param {string} [parameters.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. + */ + beginPreBackupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Backup request. + * + * @param {string} [parameters.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. + */ + 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; + + + /** + * 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} parameters Body of Backup request. + * + * @param {string} [parameters.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. + */ + beginPostBackupWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Backup request. + * + * @param {string} [parameters.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. + */ + 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; + + + /** + * 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Pre Restore partition. + * + * @param {string} [parameters.replicaGroup] Pre Restore replica group. + * + * @param {string} [parameters.requestId] Pre Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Pre Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. + * + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. + * + * @param {number} [parameters.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. + */ + beginPreRestoreWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Pre Restore partition. + * + * @param {string} [parameters.replicaGroup] Pre Restore replica group. + * + * @param {string} [parameters.requestId] Pre Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Pre Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Pre Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Pre Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.backupMetadataPropertyBag] Pre Restore backup + * metadata property bag. + * + * @param {array} [parameters.restoreFileSpec] Pre Restore restore file spec + * array. + * + * @param {number} [parameters.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. + */ + 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; + + + /** + * 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Post Restore partition. + * + * @param {string} [parameters.replicaGroup] Post Restore replica group. + * + * @param {string} [parameters.requestId] Post Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Post Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. + * + * @param {array} [parameters.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. + */ + beginPostRestoreWithHttpOperationResponse(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: 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} parameters Body of Cloud Endpoint object. + * + * @param {string} [parameters.partition] Post Restore partition. + * + * @param {string} [parameters.replicaGroup] Post Restore replica group. + * + * @param {string} [parameters.requestId] Post Restore request id. + * + * @param {string} [parameters.azureFileShareUri] Post Restore Azure file share + * uri. + * + * @param {string} [parameters.status] Post Restore Azure status. + * + * @param {string} [parameters.sourceAzureFileShareUri] Post Restore Azure + * source azure file share uri. + * + * @param {string} [parameters.failedFileList] Post Restore Azure failed file + * list. + * + * @param {array} [parameters.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. + */ + 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; +} + +/** + * @class + * ServerEndpoints + * __NOTE__: An instance of this class is automatically created for an + * instance of the StorageSyncManagementClient. + */ +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} parameters Body of Server Endpoint object. + * + * @param {string} [parameters.serverLocalPath] Server Local path. + * + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.serverResourceId] Server Resource Id. + * + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {object} [parameters.syncStatus] Sync Health Status + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, parameters: 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} parameters Body of Server Endpoint object. + * + * @param {string} [parameters.serverLocalPath] Server Local path. + * + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.serverResourceId] Server Resource Id. + * + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {object} [parameters.syncStatus] Sync Health Status + * + * @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, 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; + + + /** + * 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.parameters] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.parameters.serverLocalPath] Server Local path. + * + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' + * + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.parameters.friendlyName] Friendly Name + * + * @param {string} [options.parameters.serverResourceId] Server Resource Id. + * + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State + * + * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint + * lastWorkflowId + * + * @param {string} [options.parameters.lastOperationName] Resource Last + * Operation Name + * + * @param {object} [options.parameters.syncStatus] Sync Health Status + * + * @param {object} [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?: { parameters? : 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.parameters] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.parameters.serverLocalPath] Server Local path. + * + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' + * + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.parameters.friendlyName] Friendly Name + * + * @param {string} [options.parameters.serverResourceId] Server Resource Id. + * + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State + * + * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint + * lastWorkflowId + * + * @param {string} [options.parameters.lastOperationName] Resource Last + * Operation Name + * + * @param {object} [options.parameters.syncStatus] Sync Health Status + * + * @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?: { 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: { parameters? : 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; + + + /** + * 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; + + + /** + * 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. + */ + recallActionWithHttpOperationResponse(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. + */ + recallAction(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + recallAction(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, callback: ServiceCallback): void; + recallAction(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} parameters Body of Server Endpoint object. + * + * @param {string} [parameters.serverLocalPath] Server Local path. + * + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.serverResourceId] Server Resource Id. + * + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {object} [parameters.syncStatus] Sync Health Status + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, parameters: 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} parameters Body of Server Endpoint object. + * + * @param {string} [parameters.serverLocalPath] Server Local path. + * + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.serverResourceId] Server Resource Id. + * + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {object} [parameters.syncStatus] Sync Health Status + * + * @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, 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; + + + /** + * 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.parameters] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.parameters.serverLocalPath] Server Local path. + * + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' + * + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.parameters.friendlyName] Friendly Name + * + * @param {string} [options.parameters.serverResourceId] Server Resource Id. + * + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State + * + * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint + * lastWorkflowId + * + * @param {string} [options.parameters.lastOperationName] Resource Last + * Operation Name + * + * @param {object} [options.parameters.syncStatus] Sync Health Status + * + * @param {object} [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?: { parameters? : 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.parameters] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.parameters.serverLocalPath] Server Local path. + * + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' + * + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.parameters.friendlyName] Friendly Name + * + * @param {string} [options.parameters.serverResourceId] Server Resource Id. + * + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State + * + * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint + * lastWorkflowId + * + * @param {string} [options.parameters.lastOperationName] Resource Last + * Operation Name + * + * @param {object} [options.parameters.syncStatus] Sync Health Status + * + * @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?: { 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: { parameters? : 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; + + + /** + * 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. + */ + beginRecallActionWithHttpOperationResponse(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. + */ + beginRecallAction(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginRecallAction(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, callback: ServiceCallback): void; + beginRecallAction(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: 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 StorageSyncManagementClient. + */ +export interface RegisteredServers { + + + /** + * 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; + + + /** + * 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} parameters Body of Registered Server object. + * + * @param {string} [parameters.serverCertificate] Registered Server Certificate + * + * @param {string} [parameters.agentVersion] Registered Server Agent Version + * + * @param {string} [parameters.serverOSVersion] Registered Server OS Version + * + * @param {number} [parameters.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State + * + * @param {string} [parameters.serverRole] Registered Server serverRole + * + * @param {string} [parameters.clusterId] Registered Server clusterId + * + * @param {string} [parameters.clusterName] Registered Server clusterName + * + * @param {string} [parameters.serverId] Registered Server serverId + * + * @param {string} [parameters.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {string} [parameters.discoveryEndpointUri] Resource + * discoveryEndpointUri + * + * @param {string} [parameters.resourceLocation] Resource Location + * + * @param {string} [parameters.serviceLocation] Service Location + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, parameters: 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} parameters Body of Registered Server object. + * + * @param {string} [parameters.serverCertificate] Registered Server Certificate + * + * @param {string} [parameters.agentVersion] Registered Server Agent Version + * + * @param {string} [parameters.serverOSVersion] Registered Server OS Version + * + * @param {number} [parameters.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State + * + * @param {string} [parameters.serverRole] Registered Server serverRole + * + * @param {string} [parameters.clusterId] Registered Server clusterId + * + * @param {string} [parameters.clusterName] Registered Server clusterName + * + * @param {string} [parameters.serverId] Registered Server serverId + * + * @param {string} [parameters.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {string} [parameters.discoveryEndpointUri] Resource + * discoveryEndpointUri + * + * @param {string} [parameters.resourceLocation] Resource Location + * + * @param {string} [parameters.serviceLocation] Service Location + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri + * + * @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, 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; + + + /** + * 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} parameters Body of Registered Server object. + * + * @param {string} [parameters.serverCertificate] Registered Server Certificate + * + * @param {string} [parameters.agentVersion] Registered Server Agent Version + * + * @param {string} [parameters.serverOSVersion] Registered Server OS Version + * + * @param {number} [parameters.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State + * + * @param {string} [parameters.serverRole] Registered Server serverRole + * + * @param {string} [parameters.clusterId] Registered Server clusterId + * + * @param {string} [parameters.clusterName] Registered Server clusterName + * + * @param {string} [parameters.serverId] Registered Server serverId + * + * @param {string} [parameters.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {string} [parameters.discoveryEndpointUri] Resource + * discoveryEndpointUri + * + * @param {string} [parameters.resourceLocation] Resource Location + * + * @param {string} [parameters.serviceLocation] Service Location + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, parameters: 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} parameters Body of Registered Server object. + * + * @param {string} [parameters.serverCertificate] Registered Server Certificate + * + * @param {string} [parameters.agentVersion] Registered Server Agent Version + * + * @param {string} [parameters.serverOSVersion] Registered Server OS Version + * + * @param {number} [parameters.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State + * + * @param {string} [parameters.serverRole] Registered Server serverRole + * + * @param {string} [parameters.clusterId] Registered Server clusterId + * + * @param {string} [parameters.clusterName] Registered Server clusterName + * + * @param {string} [parameters.serverId] Registered Server serverId + * + * @param {string} [parameters.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {string} [parameters.discoveryEndpointUri] Resource + * discoveryEndpointUri + * + * @param {string} [parameters.resourceLocation] Resource Location + * + * @param {string} [parameters.serviceLocation] Service Location + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri + * + * @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, 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; + + + /** + * 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 StorageSyncManagementClient. + */ +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; + + + /** + * 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. + */ + abortWithHttpOperationResponse(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. + */ + 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 new file mode 100644 index 0000000000..9f76216fd2 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/index.js @@ -0,0 +1,23 @@ +/* + * 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.Operations = require('./operations'); +exports.StorageSyncServices = require('./storageSyncServices'); +exports.SyncGroups = require('./syncGroups'); +exports.CloudEndpoints = require('./cloudEndpoints'); +exports.ServerEndpoints = require('./serverEndpoints'); +exports.RegisteredServers = require('./registeredServers'); +exports.Workflows = require('./workflows'); 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 new file mode 100644 index 0000000000..70c88485da --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/registeredServers.js @@ -0,0 +1,1659 @@ +/* + * 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['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. + * + * @param {string} resourceGroupName The name 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['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['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} parameters Body of Registered Server object. + * + * @param {string} [parameters.serverCertificate] Registered Server Certificate + * + * @param {string} [parameters.agentVersion] Registered Server Agent Version + * + * @param {string} [parameters.serverOSVersion] Registered Server OS Version + * + * @param {number} [parameters.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State + * + * @param {string} [parameters.serverRole] Registered Server serverRole + * + * @param {string} [parameters.clusterId] Registered Server clusterId + * + * @param {string} [parameters.clusterName] Registered Server clusterName + * + * @param {string} [parameters.serverId] Registered Server serverId + * + * @param {string} [parameters.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {string} [parameters.discoveryEndpointUri] Resource + * discoveryEndpointUri + * + * @param {string} [parameters.resourceLocation] Resource Location + * + * @param {string} [parameters.serviceLocation] Service Location + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri + * + * @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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreate(resourceGroupName, storageSyncServiceName, serverId, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['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} parameters Body of Registered Server object. + * + * @param {string} [parameters.serverCertificate] Registered Server Certificate + * + * @param {string} [parameters.agentVersion] Registered Server Agent Version + * + * @param {string} [parameters.serverOSVersion] Registered Server OS Version + * + * @param {number} [parameters.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State + * + * @param {string} [parameters.serverRole] Registered Server serverRole + * + * @param {string} [parameters.clusterId] Registered Server clusterId + * + * @param {string} [parameters.clusterName] Registered Server clusterName + * + * @param {string} [parameters.serverId] Registered Server serverId + * + * @param {string} [parameters.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {string} [parameters.discoveryEndpointUri] Resource + * discoveryEndpointUri + * + * @param {string} [parameters.resourceLocation] Resource Location + * + * @param {string} [parameters.serviceLocation] Service Location + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri + * + * @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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['RegisteredServer']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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['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['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 RegisteredServers. */ +class RegisteredServers { + /** + * Create a RegisteredServers. + * @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; + this._beginCreate = _beginCreate; + 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. + * + * @param {string} resourceGroupName The name 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} parameters Body of Registered Server object. + * + * @param {string} [parameters.serverCertificate] Registered Server Certificate + * + * @param {string} [parameters.agentVersion] Registered Server Agent Version + * + * @param {string} [parameters.serverOSVersion] Registered Server OS Version + * + * @param {number} [parameters.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State + * + * @param {string} [parameters.serverRole] Registered Server serverRole + * + * @param {string} [parameters.clusterId] Registered Server clusterId + * + * @param {string} [parameters.clusterName] Registered Server clusterName + * + * @param {string} [parameters.serverId] Registered Server serverId + * + * @param {string} [parameters.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {string} [parameters.discoveryEndpointUri] Resource + * discoveryEndpointUri + * + * @param {string} [parameters.resourceLocation] Resource Location + * + * @param {string} [parameters.serviceLocation] Service Location + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + 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); } + 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} parameters Body of Registered Server object. + * + * @param {string} [parameters.serverCertificate] Registered Server Certificate + * + * @param {string} [parameters.agentVersion] Registered Server Agent Version + * + * @param {string} [parameters.serverOSVersion] Registered Server OS Version + * + * @param {number} [parameters.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State + * + * @param {string} [parameters.serverRole] Registered Server serverRole + * + * @param {string} [parameters.clusterId] Registered Server clusterId + * + * @param {string} [parameters.clusterName] Registered Server clusterName + * + * @param {string} [parameters.serverId] Registered Server serverId + * + * @param {string} [parameters.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {string} [parameters.discoveryEndpointUri] Resource + * discoveryEndpointUri + * + * @param {string} [parameters.resourceLocation] Resource Location + * + * @param {string} [parameters.serviceLocation] Service Location + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri + * + * @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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._create(resourceGroupName, storageSyncServiceName, serverId, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, storageSyncServiceName, serverId, parameters, 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} parameters Body of Registered Server object. + * + * @param {string} [parameters.serverCertificate] Registered Server Certificate + * + * @param {string} [parameters.agentVersion] Registered Server Agent Version + * + * @param {string} [parameters.serverOSVersion] Registered Server OS Version + * + * @param {number} [parameters.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State + * + * @param {string} [parameters.serverRole] Registered Server serverRole + * + * @param {string} [parameters.clusterId] Registered Server clusterId + * + * @param {string} [parameters.clusterName] Registered Server clusterName + * + * @param {string} [parameters.serverId] Registered Server serverId + * + * @param {string} [parameters.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {string} [parameters.discoveryEndpointUri] Resource + * discoveryEndpointUri + * + * @param {string} [parameters.resourceLocation] Resource Location + * + * @param {string} [parameters.serviceLocation] Service Location + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + 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); } + 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} parameters Body of Registered Server object. + * + * @param {string} [parameters.serverCertificate] Registered Server Certificate + * + * @param {string} [parameters.agentVersion] Registered Server Agent Version + * + * @param {string} [parameters.serverOSVersion] Registered Server OS Version + * + * @param {number} [parameters.serverManagementtErrorCode] Registered Server + * Management Error Code + * + * @param {string} [parameters.lastHeartBeat] Registered Server last heart beat + * + * @param {string} [parameters.provisioningState] Registered Server + * Provisioning State + * + * @param {string} [parameters.serverRole] Registered Server serverRole + * + * @param {string} [parameters.clusterId] Registered Server clusterId + * + * @param {string} [parameters.clusterName] Registered Server clusterName + * + * @param {string} [parameters.serverId] Registered Server serverId + * + * @param {string} [parameters.storageSyncServiceUid] Registered Server + * storageSyncServiceUid + * + * @param {string} [parameters.lastWorkflowId] Registered Server lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {string} [parameters.discoveryEndpointUri] Resource + * discoveryEndpointUri + * + * @param {string} [parameters.resourceLocation] Resource Location + * + * @param {string} [parameters.serviceLocation] Service Location + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.managementEndpointUri] Management Endpoint Uri + * + * @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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreate(resourceGroupName, storageSyncServiceName, serverId, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreate(resourceGroupName, storageSyncServiceName, serverId, parameters, 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/serverEndpoints.js b/lib/services/storagesyncManagement/lib/operations/serverEndpoints.js new file mode 100644 index 0000000000..020e7a6d1c --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/serverEndpoints.js @@ -0,0 +1,2645 @@ +/* + * 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} parameters Body of Server Endpoint object. + * + * @param {string} [parameters.serverLocalPath] Server Local path. + * + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.serverResourceId] Server Resource Id. + * + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {object} [parameters.syncStatus] Sync Health Status + * + * @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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreate(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['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.parameters] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.parameters.serverLocalPath] Server Local path. + * + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' + * + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.parameters.friendlyName] Friendly Name + * + * @param {string} [options.parameters.serverResourceId] Server Resource Id. + * + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State + * + * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint + * lastWorkflowId + * + * @param {string} [options.parameters.lastOperationName] Resource Last + * Operation Name + * + * @param {object} [options.parameters.syncStatus] Sync Health Status + * + * @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['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['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); + }); + }); +} + +/** + * 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 _recallAction(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.beginRecallAction(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} parameters Body of Server Endpoint object. + * + * @param {string} [parameters.serverLocalPath] Server Local path. + * + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.serverResourceId] Server Resource Id. + * + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {object} [parameters.syncStatus] Sync Health Status + * + * @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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ServerEndpoint']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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['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.parameters] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.parameters.serverLocalPath] Server Local path. + * + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' + * + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.parameters.friendlyName] Friendly Name + * + * @param {string} [options.parameters.serverResourceId] Server Resource Id. + * + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State + * + * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint + * lastWorkflowId + * + * @param {string} [options.parameters.lastOperationName] Resource Last + * Operation Name + * + * @param {object} [options.parameters.syncStatus] Sync Health Status + * + * @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 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') { + 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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ServerEndpoint']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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['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['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); + }); +} + +/** + * 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 _beginRecallAction(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._recallAction = _recallAction; + this._beginCreate = _beginCreate; + this._beginUpdate = _beginUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginRecallAction = _beginRecallAction; + } + + /** + * 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} parameters Body of Server Endpoint object. + * + * @param {string} [parameters.serverLocalPath] Server Local path. + * + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.serverResourceId] Server Resource Id. + * + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {object} [parameters.syncStatus] Sync Health Status + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + 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); } + 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} parameters Body of Server Endpoint object. + * + * @param {string} [parameters.serverLocalPath] Server Local path. + * + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.serverResourceId] Server Resource Id. + * + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {object} [parameters.syncStatus] Sync Health Status + * + * @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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._create(resourceGroupName, 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, parameters, 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.parameters] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.parameters.serverLocalPath] Server Local path. + * + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' + * + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.parameters.friendlyName] Friendly Name + * + * @param {string} [options.parameters.serverResourceId] Server Resource Id. + * + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State + * + * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint + * lastWorkflowId + * + * @param {string} [options.parameters.lastOperationName] Resource Last + * Operation Name + * + * @param {object} [options.parameters.syncStatus] Sync Health Status + * + * @param {object} [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.parameters] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.parameters.serverLocalPath] Server Local path. + * + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' + * + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.parameters.friendlyName] Friendly Name + * + * @param {string} [options.parameters.serverResourceId] Server Resource Id. + * + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State + * + * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint + * lastWorkflowId + * + * @param {string} [options.parameters.lastOperationName] Resource Last + * Operation Name + * + * @param {object} [options.parameters.syncStatus] Sync Health Status + * + * @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); + } + } + + /** + * 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); + } + } + + /** + * 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. + */ + recallActionWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._recallAction(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. + */ + recallAction(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._recallAction(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._recallAction(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} parameters Body of Server Endpoint object. + * + * @param {string} [parameters.serverLocalPath] Server Local path. + * + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.serverResourceId] Server Resource Id. + * + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {object} [parameters.syncStatus] Sync Health Status + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + 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); } + 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} parameters Body of Server Endpoint object. + * + * @param {string} [parameters.serverLocalPath] Server Local path. + * + * @param {string} [parameters.cloudTiering] Cloud Tiering. Possible values + * include: 'on', 'off' + * + * @param {number} [parameters.volumeFreeSpacePercent] Level of free space to + * be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [parameters.friendlyName] Friendly Name + * + * @param {string} [parameters.serverResourceId] Server Resource Id. + * + * @param {string} [parameters.provisioningState] ServerEndpoint Provisioning + * State + * + * @param {string} [parameters.lastWorkflowId] ServerEndpoint lastWorkflowId + * + * @param {string} [parameters.lastOperationName] Resource Last Operation Name + * + * @param {object} [parameters.syncStatus] Sync Health Status + * + * @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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreate(resourceGroupName, 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, parameters, 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.parameters] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.parameters.serverLocalPath] Server Local path. + * + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' + * + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.parameters.friendlyName] Friendly Name + * + * @param {string} [options.parameters.serverResourceId] Server Resource Id. + * + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State + * + * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint + * lastWorkflowId + * + * @param {string} [options.parameters.lastOperationName] Resource Last + * Operation Name + * + * @param {object} [options.parameters.syncStatus] Sync Health Status + * + * @param {object} [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.parameters] Any of the properties applicable in PUT + * request. + * + * @param {string} [options.parameters.serverLocalPath] Server Local path. + * + * @param {string} [options.parameters.cloudTiering] Cloud Tiering. Possible + * values include: 'on', 'off' + * + * @param {number} [options.parameters.volumeFreeSpacePercent] Level of free + * space to be maintained by Cloud Tiering if it is enabled. + * + * @param {string} [options.parameters.friendlyName] Friendly Name + * + * @param {string} [options.parameters.serverResourceId] Server Resource Id. + * + * @param {string} [options.parameters.provisioningState] ServerEndpoint + * Provisioning State + * + * @param {string} [options.parameters.lastWorkflowId] ServerEndpoint + * lastWorkflowId + * + * @param {string} [options.parameters.lastOperationName] Resource Last + * Operation Name + * + * @param {object} [options.parameters.syncStatus] Sync Health Status + * + * @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); + } + } + + /** + * 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. + */ + beginRecallActionWithHttpOperationResponse(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginRecallAction(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. + */ + beginRecallAction(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._beginRecallAction(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginRecallAction(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 new file mode 100644 index 0000000000..3dffc26791 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/storageSyncServices.js @@ -0,0 +1,1783 @@ +/* + * 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; + +/** + * Check the give namespace name availability. + * + * @param {string} locationName The desired region for the name check. + * + * @param {object} parameters Parameters to check availability of the given + * namespace name + * + * @param {string} parameters.name The name to check for availability + * + * @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 CheckNameAvailabilityResult} for more + * information. + * + * {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 _checkNameAvailability(locationName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + if (parameters === null || parameters === undefined) + { + parameters = {}; + } + // Validate + try { + if (locationName === null || locationName === undefined || typeof locationName.valueOf() !== 'string') { + throw new Error('locationName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/locations/{locationName}/checkNameAvailability'; + requestUrl = requestUrl.replace('{locationName}', encodeURIComponent(locationName)); + 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 = '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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['CheckNameAvailabilityParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['CheckNameAvailabilityResult']().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 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} parameters 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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['StorageSyncService']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + 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['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['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['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.parameters] 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 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') { + 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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['StorageSyncService']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + 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['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['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); + }); +} + +/** + * 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 {StorageSyncManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._checkNameAvailability = _checkNameAvailability; + this._create = _create; + this._get = _get; + this._update = _update; + this._deleteMethod = _deleteMethod; + this._listByResourceGroup = _listByResourceGroup; + this._listBySubscription = _listBySubscription; + } + + /** + * Check the give namespace name availability. + * + * @param {string} locationName The desired region for the name check. + * + * @param {object} parameters Parameters to check availability of the given + * namespace name + * + * @param {string} parameters.name The name to check for availability + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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. + */ + checkNameAvailabilityWithHttpOperationResponse(locationName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._checkNameAvailability(locationName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Check the give namespace name availability. + * + * @param {string} locationName The desired region for the name check. + * + * @param {object} parameters Parameters to check availability of the given + * namespace name + * + * @param {string} parameters.name The name to check for availability + * + * @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 {CheckNameAvailabilityResult} - 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 CheckNameAvailabilityResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + checkNameAvailability(locationName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._checkNameAvailability(locationName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._checkNameAvailability(locationName, parameters, options, optionalCallback); + } + } + + /** + * 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} parameters 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, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._create(resourceGroupName, storageSyncServiceName, parameters, 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} parameters 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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._create(resourceGroupName, storageSyncServiceName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, storageSyncServiceName, parameters, 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.parameters] 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.parameters] 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); + } + } + + /** + * 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 new file mode 100644 index 0000000000..5403647273 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/syncGroups.js @@ -0,0 +1,1081 @@ +/* + * 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['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. + * + * @param {string} resourceGroupName The name 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} parameters Sync Group Body + * + * @param {string} [parameters.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, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (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 (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['SyncGroup']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + 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['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['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['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['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 SyncGroups. */ +class SyncGroups { + /** + * Create a SyncGroups. + * @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. + * + * @param {string} resourceGroupName The name 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} parameters Sync Group Body + * + * @param {string} [parameters.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, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + 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); } + 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} parameters Sync Group Body + * + * @param {string} [parameters.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, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._create(resourceGroupName, storageSyncServiceName, syncGroupName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, storageSyncServiceName, syncGroupName, parameters, 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..7786329153 --- /dev/null +++ b/lib/services/storagesyncManagement/lib/operations/workflows.js @@ -0,0 +1,536 @@ +/* + * 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['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['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); + }); +} + +/** + * 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 {StorageSyncManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._abort = _abort; + } + + /** + * 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); + } + } + + /** + * 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..27ea21fd0f --- /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] - The preferred language for the response. + * + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + */ + constructor(credentials: ServiceClientCredentials, subscriptionId: string, baseUri?: string, options?: AzureServiceClientOptions); + + credentials: ServiceClientCredentials; + + 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..2216907265 --- /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] - The preferred language for the response. + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. + * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + */ + constructor(credentials, subscriptionId, baseUri, options) { + if (credentials === null || credentials === undefined) { + throw new Error('\'credentials\' cannot be null.'); + } + if (subscriptionId === null || subscriptionId === undefined) { + throw new Error('\'subscriptionId\' cannot be null.'); + } + + if (!options) options = {}; + + super(credentials, options); + + this.apiVersion = '2018-04-02'; + 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-lock.json b/lib/services/storagesyncManagement/package-lock.json new file mode 100644 index 0000000000..967c66460d --- /dev/null +++ b/lib/services/storagesyncManagement/package-lock.json @@ -0,0 +1,483 @@ +{ + "name": "azure-arm-storagesync", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@types/node": { + "version": "8.10.26", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.26.tgz", + "integrity": "sha512-opk6bLLErLSwyVVJeSH5Ek7ZWOBSsN0JrvXTNVGLXLAXKB9xlTYajrplR44xVyMrmbut94H6uJ9jqzM/12jxkA==" + }, + "adal-node": { + "version": "0.1.28", + "resolved": "https://registry.npmjs.org/adal-node/-/adal-node-0.1.28.tgz", + "integrity": "sha1-RoxLs+u9lrEnBmn0ucuk4AZepIU=", + "requires": { + "@types/node": "^8.0.47", + "async": ">=0.6.0", + "date-utils": "*", + "jws": "3.x.x", + "request": ">= 2.52.0", + "underscore": ">= 1.3.1", + "uuid": "^3.1.0", + "xmldom": ">= 0.1.x", + "xpath.js": "~1.1.0" + } + }, + "ajv": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "requires": { + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" + } + }, + "asn1": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", + "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "async": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz", + "integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==", + "requires": { + "lodash": "^4.14.0" + } + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", + "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "optional": true, + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=" + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + }, + "combined-stream": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", + "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "date-utils": { + "version": "1.2.21", + "resolved": "https://registry.npmjs.org/date-utils/-/date-utils-1.2.21.tgz", + "integrity": "sha1-YfsWzcEnSzyayq/+n8ad+HIKK2Q=" + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "duplexer": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", + "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=" + }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "optional": true, + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "ecdsa-sig-formatter": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.10.tgz", + "integrity": "sha1-HFlQAPBKiJffuFAAiSoPTDOvhsM=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-deep-equal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", + "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "1.0.6", + "mime-types": "^2.1.12" + } + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz", + "integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==", + "requires": { + "ajv": "^5.3.0", + "har-schema": "^2.0.0" + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "optional": true + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "jwa": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.1.6.tgz", + "integrity": "sha512-tBO/cf++BUsJkYql/kBbJroKOgHWEigTKBAjjBEmrMGYd1QMBC74Hr4Wo2zCZw6ZrVhlJPvoMrkcOnlWR/DJfw==", + "requires": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.10", + "safe-buffer": "^5.0.1" + } + }, + "jws": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.1.5.tgz", + "integrity": "sha512-GsCSexFADNQUr8T5HPJvayTjvPIfoyJPtLQBwn5a4WZQchcrPMPMAWcC1AzJVRDKyD6ZPROPAxgv6rfHViO4uQ==", + "requires": { + "jwa": "^1.1.5", + "safe-buffer": "^5.0.1" + } + }, + "lodash": { + "version": "4.17.10", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", + "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==" + }, + "mime-db": { + "version": "1.35.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.35.0.tgz", + "integrity": "sha512-JWT/IcCTsB0Io3AhWUMjRqucrHSPsSf2xKLaRldJVULioggvkJvggZ3VXNNSRkCddE6D+BUI4HEIZIA2OjwIvg==" + }, + "mime-types": { + "version": "2.1.19", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.19.tgz", + "integrity": "sha512-P1tKYHVSZ6uFo26mtnve4HQFE3koh1UWVkp8YUC+ESBHe945xWSoXuHHiGarDqcEZ+whpCDnlNw5LON0kLo+sw==", + "requires": { + "mime-db": "~1.35.0" + } + }, + "moment": { + "version": "2.22.2", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.22.2.tgz", + "integrity": "sha1-PCV/mDn8DpP/UxSWMiOeuQeD/2Y=" + }, + "ms-rest": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/ms-rest/-/ms-rest-2.3.6.tgz", + "integrity": "sha512-M+Lx9P7Wy4TeAk7jqPLwGS1QS1gvxF6Xo+OHv5j1g3Kcb44T/GTUuSjxTKarF6aKyeacZH1ZD++Nt7pcql7dDA==", + "requires": { + "duplexer": "^0.1.1", + "is-buffer": "^1.1.6", + "is-stream": "^1.1.0", + "moment": "^2.21.0", + "request": "^2.87.0", + "through": "^2.3.8", + "tunnel": "0.0.5", + "uuid": "^3.2.1" + } + }, + "ms-rest-azure": { + "version": "2.5.7", + "resolved": "https://registry.npmjs.org/ms-rest-azure/-/ms-rest-azure-2.5.7.tgz", + "integrity": "sha512-e4lgB0z29Dx4ufu/c+PmEAYY1WXq98GYUBkE+iRx7WsxsN04lrM3B1vj8y+B8rKt7clPUE0niqB9VovVL8zvag==", + "requires": { + "adal-node": "^0.1.28", + "async": "2.6.0", + "moment": "^2.22.2", + "ms-rest": "^2.3.2", + "uuid": "^3.2.1" + } + }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "psl": { + "version": "1.1.29", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", + "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==" + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + }, + "request": { + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "sshpk": { + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz", + "integrity": "sha1-xvxhZIo9nE52T9P8306hBeSSupg=", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" + }, + "tough-cookie": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + } + }, + "tunnel": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.5.tgz", + "integrity": "sha512-gj5sdqherx4VZKMcBA4vewER7zdK25Td+z1npBqpbDys4eJrLx+SlYjJvq1bDXs2irkuJM5pf8ktaEQVipkrbA==" + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "optional": true + }, + "underscore": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", + "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==" + }, + "uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "xmldom": { + "version": "0.1.27", + "resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.1.27.tgz", + "integrity": "sha1-1QH5ezvbQDr4757MIFcxh6rawOk=" + }, + "xpath.js": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xpath.js/-/xpath.js-1.1.0.tgz", + "integrity": "sha512-jg+qkfS4K8E7965sqaUl8mRngXiKb3WZGfONgE18pr03FUQiuSV6G+Ej4tS55B+rIQSFEIw3phdVAQ4pPqNWfQ==" + } + } +} diff --git a/lib/services/storagesyncManagement/package.json b/lib/services/storagesyncManagement/package.json new file mode 100644 index 0000000000..22c93d1e4d --- /dev/null +++ b/lib/services/storagesyncManagement/package.json @@ -0,0 +1,25 @@ +{ + "name": "azure-arm-storagesync", + "author": "Microsoft Corporation", + "description": "StorageSyncManagementClient 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/storageSyncManagementClient.js", + "types": "./lib/storageSyncManagementClient.d.ts", + "homepage": "https://github.com/azure/azure-sdk-for-node/tree/master/lib/services/storagesyncManagement", + "repository": { + "type": "git", + "url": "https://github.com/azure/azure-sdk-for-node.git" + }, + "bugs": { + "url": "https://github.com/azure/azure-sdk-for-node/issues" + } +}