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" + } +}