diff --git a/lib/services/rediscachemanagement/lib/models/exportRDBParameters.js b/lib/services/rediscachemanagement/lib/models/exportRDBParameters.js index 30b8170518..3606207837 100644 --- a/lib/services/rediscachemanagement/lib/models/exportRDBParameters.js +++ b/lib/services/rediscachemanagement/lib/models/exportRDBParameters.js @@ -18,7 +18,7 @@ * * @member {string} [format] File format. * - * @member {string} prefix Prifix to use for exported files. + * @member {string} prefix Prefix to use for exported files. * * @member {string} container Container name to export to. * diff --git a/lib/services/rediscachemanagement/lib/models/index.d.ts b/lib/services/rediscachemanagement/lib/models/index.d.ts index 9b53ce9c39..95530c232d 100644 --- a/lib/services/rediscachemanagement/lib/models/index.d.ts +++ b/lib/services/rediscachemanagement/lib/models/index.d.ts @@ -8,6 +8,9 @@ * regenerated. */ +import * as msRestAzure from 'ms-rest-azure'; +exports.BaseResource = msRestAzure.BaseResource; +exports.CloudError = msRestAzure.CloudError; /** * @class @@ -34,26 +37,35 @@ export interface Sku { /** * @class - * Initializes a new instance of the RedisProperties class. + * Initializes a new instance of the Resource class. * @constructor - * Properties supplied to CreateOrUpdate redis operation. + * The Resource definition. * - * @member {string} [redisVersion] RedisVersion parameter has been deprecated. - * As such, it is no longer necessary to provide this parameter and any value - * specified is ignored. + * @member {string} [id] Resource Id * - * @member {object} sku What sku of redis cache to deploy. + * @member {string} [name] Resource name * - * @member {string} [sku.name] What type of redis cache to deploy. Valid - * values: (Basic, Standard, Premium). Possible values include: 'Basic', - * 'Standard', 'Premium' + * @member {string} [type] Resource type * - * @member {string} [sku.family] Which family to use. Valid values: (C, P). - * Possible values include: 'C', 'P' + * @member {string} location Resource location * - * @member {number} [sku.capacity] What size of redis cache to deploy. Valid - * values: for C family (0, 1, 2, 3, 4, 5, 6), for P family (1, 2, 3, 4) + * @member {object} [tags] Resource tags * + */ +export interface Resource extends BaseResource { + id?: string; + name?: string; + type?: string; + location: string; + tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the RedisCreateParameters class. + * @constructor + * Parameters supplied to the Create Redis operation. + * * @member {object} [redisConfiguration] All Redis Settings. Few possible * keys: rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value * etc. @@ -73,63 +85,35 @@ export interface Sku { * @member {string} [staticIP] Required when deploying a redis cache inside an * existing Azure Virtual Network. * + * @member {object} sku What sku of redis cache to deploy. + * + * @member {string} [sku.name] What type of redis cache to deploy. Valid + * values: (Basic, Standard, Premium). Possible values include: 'Basic', + * 'Standard', 'Premium' + * + * @member {string} [sku.family] Which family to use. Valid values: (C, P). + * Possible values include: 'C', 'P' + * + * @member {number} [sku.capacity] What size of redis cache to deploy. Valid + * values: for C family (0, 1, 2, 3, 4, 5, 6), for P family (1, 2, 3, 4) + * */ -export interface RedisProperties { - redisVersion?: string; - sku: Sku; +export interface RedisCreateParameters extends Resource { redisConfiguration?: { [propertyName: string]: string }; enableNonSslPort?: boolean; tenantSettings?: { [propertyName: string]: string }; shardCount?: number; subnetId?: string; staticIP?: string; + sku: Sku; } /** * @class - * Initializes a new instance of the Resource class. - * @constructor - * @member {string} [id] Resource Id - * - * @member {string} [name] Resource name - * - * @member {string} [type] Resource type - * - * @member {string} location Resource location - * - * @member {object} [tags] Resource tags - * - */ -export interface Resource extends BaseResource { - id?: string; - name?: string; - type?: string; - location: string; - tags?: { [propertyName: string]: string }; -} - -/** - * @class - * Initializes a new instance of the RedisCreateOrUpdateParameters class. + * Initializes a new instance of the RedisUpdateParameters class. * @constructor - * Parameters supplied to the CreateOrUpdate Redis operation. + * Parameters supplied to the Update Redis operation. * - * @member {string} [redisVersion] RedisVersion parameter has been deprecated. - * As such, it is no longer necessary to provide this parameter and any value - * specified is ignored. - * - * @member {object} sku What sku of redis cache to deploy. - * - * @member {string} [sku.name] What type of redis cache to deploy. Valid - * values: (Basic, Standard, Premium). Possible values include: 'Basic', - * 'Standard', 'Premium' - * - * @member {string} [sku.family] Which family to use. Valid values: (C, P). - * Possible values include: 'C', 'P' - * - * @member {number} [sku.capacity] What size of redis cache to deploy. Valid - * values: for C family (0, 1, 2, 3, 4, 5, 6), for P family (1, 2, 3, 4) - * * @member {object} [redisConfiguration] All Redis Settings. Few possible * keys: rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value * etc. @@ -149,16 +133,30 @@ export interface Resource extends BaseResource { * @member {string} [staticIP] Required when deploying a redis cache inside an * existing Azure Virtual Network. * + * @member {object} [sku] What sku of redis cache to deploy. + * + * @member {string} [sku.name] What type of redis cache to deploy. Valid + * values: (Basic, Standard, Premium). Possible values include: 'Basic', + * 'Standard', 'Premium' + * + * @member {string} [sku.family] Which family to use. Valid values: (C, P). + * Possible values include: 'C', 'P' + * + * @member {number} [sku.capacity] What size of redis cache to deploy. Valid + * values: for C family (0, 1, 2, 3, 4, 5, 6), for P family (1, 2, 3, 4) + * + * @member {object} [tags] Resource tags + * */ -export interface RedisCreateOrUpdateParameters extends Resource { - redisVersion?: string; - sku: Sku; +export interface RedisUpdateParameters { redisConfiguration?: { [propertyName: string]: string }; enableNonSslPort?: boolean; tenantSettings?: { [propertyName: string]: string }; shardCount?: number; subnetId?: string; staticIP?: string; + sku?: Sku; + tags?: { [propertyName: string]: string }; } /** @@ -181,25 +179,19 @@ export interface RedisAccessKeys { /** * @class - * Initializes a new instance of the RedisResourceWithAccessKey class. + * Initializes a new instance of the RedisResource class. * @constructor - * A redis item in CreateOrUpdate Operation response. + * A single redis item in List or Get Operation. * - * @member {string} [redisVersion] RedisVersion parameter has been deprecated. - * As such, it is no longer necessary to provide this parameter and any value - * specified is ignored. + * @member {string} [redisVersion] Redis Version. * - * @member {object} sku What sku of redis cache to deploy. + * @member {string} [provisioningState] Redis instance provisioning status * - * @member {string} [sku.name] What type of redis cache to deploy. Valid - * values: (Basic, Standard, Premium). Possible values include: 'Basic', - * 'Standard', 'Premium' + * @member {string} [hostName] Redis host name * - * @member {string} [sku.family] Which family to use. Valid values: (C, P). - * Possible values include: 'C', 'P' + * @member {number} [port] Redis non-ssl port * - * @member {number} [sku.capacity] What size of redis cache to deploy. Valid - * values: for C family (0, 1, 2, 3, 4, 5, 6), for P family (1, 2, 3, 4) + * @member {number} [sslPort] Redis ssl port * * @member {object} [redisConfiguration] All Redis Settings. Few possible * keys: rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value @@ -220,49 +212,6 @@ export interface RedisAccessKeys { * @member {string} [staticIP] Required when deploying a redis cache inside an * existing Azure Virtual Network. * - * @member {string} [provisioningState] Redis instance provisioning status - * - * @member {string} [hostName] Redis host name - * - * @member {number} [port] Redis non-ssl port - * - * @member {number} [sslPort] Redis ssl port - * - * @member {object} [accessKeys] Redis cache access keys. - * - * @member {string} [accessKeys.primaryKey] The current primary key that - * clients can use to authenticate with redis cache. - * - * @member {string} [accessKeys.secondaryKey] The current secondary key that - * clients can use to authenticate with redis cache. - * - */ -export interface RedisResourceWithAccessKey extends Resource { - redisVersion?: string; - sku: Sku; - redisConfiguration?: { [propertyName: string]: string }; - enableNonSslPort?: boolean; - tenantSettings?: { [propertyName: string]: string }; - shardCount?: number; - subnetId?: string; - staticIP?: string; - provisioningState?: string; - hostName?: string; - port?: number; - sslPort?: number; - accessKeys?: RedisAccessKeys; -} - -/** - * @class - * Initializes a new instance of the RedisResource class. - * @constructor - * A single redis item in List or Get Operation. - * - * @member {string} [redisVersion] RedisVersion parameter has been deprecated. - * As such, it is no longer necessary to provide this parameter and any value - * specified is ignored. - * * @member {object} sku What sku of redis cache to deploy. * * @member {string} [sku.name] What type of redis cache to deploy. Valid @@ -275,65 +224,36 @@ export interface RedisResourceWithAccessKey extends Resource { * @member {number} [sku.capacity] What size of redis cache to deploy. Valid * values: for C family (0, 1, 2, 3, 4, 5, 6), for P family (1, 2, 3, 4) * - * @member {object} [redisConfiguration] All Redis Settings. Few possible - * keys: rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value - * etc. - * - * @member {boolean} [enableNonSslPort] If the value is true, then the non-ssl - * redis server port (6379) will be enabled. - * - * @member {object} [tenantSettings] tenantSettings - * - * @member {number} [shardCount] The number of shards to be created on a - * Premium Cluster Cache. - * - * @member {string} [subnetId] The full resource ID of a subnet in a virtual - * network to deploy the redis cache in. Example format: - * /subscriptions/{subid}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1 - * - * @member {string} [staticIP] Required when deploying a redis cache inside an - * existing Azure Virtual Network. - * - * @member {string} [provisioningState] Redis instance provisioning status - * - * @member {string} [hostName] Redis host name - * - * @member {number} [port] Redis non-ssl port - * - * @member {number} [sslPort] Redis ssl port - * */ export interface RedisResource extends Resource { redisVersion?: string; - sku: Sku; + provisioningState?: string; + hostName?: string; + port?: number; + sslPort?: number; redisConfiguration?: { [propertyName: string]: string }; enableNonSslPort?: boolean; tenantSettings?: { [propertyName: string]: string }; shardCount?: number; subnetId?: string; staticIP?: string; - provisioningState?: string; - hostName?: string; - port?: number; - sslPort?: number; + sku: Sku; } /** * @class - * Initializes a new instance of the RedisListKeysResult class. + * Initializes a new instance of the RedisListResult class. * @constructor - * The response of redis list keys operation. + * The response of list redis operation. * - * @member {string} [primaryKey] The current primary key that clients can use - * to authenticate with redis cache. + * @member {array} [value] Results of the list operation * - * @member {string} [secondaryKey] The current secondary key that clients can - * use to authenticate with redis cache. + * @member {string} [nextLink] Link for next set of locations. * */ -export interface RedisListKeysResult { - primaryKey?: string; - secondaryKey?: string; +export interface RedisListResult { + value?: RedisResource[]; + nextLink?: string; } /** @@ -377,7 +297,7 @@ export interface RedisRebootParameters { * * @member {string} [format] File format. * - * @member {string} prefix Prifix to use for exported files. + * @member {string} prefix Prefix to use for exported files. * * @member {string} container Container name to export to. * @@ -408,9 +328,11 @@ export interface ImportRDBParameters { * @class * Initializes a new instance of the ScheduleEntry class. * @constructor + * Patch schedule entry for Premium Redis Cache. + * * @member {string} dayOfWeek Day of week when cache can be patched. Possible * values include: 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', - * 'Saturday', 'Sunday' + * 'Saturday', 'Sunday', 'Everyday', 'Weekend' * * @member {number} startHourUtc Start hour after which cache patching can * start. @@ -427,20 +349,7 @@ export interface ScheduleEntry { /** * @class - * Initializes a new instance of the RedisPatchSchedulesRequest class. - * @constructor - * Parameters to set patch schedules for redis cache. - * - * @member {array} scheduleEntries List of patch schedules for redis cache. - * - */ -export interface RedisPatchSchedulesRequest { - scheduleEntries: ScheduleEntry[]; -} - -/** - * @class - * Initializes a new instance of the RedisPatchSchedulesResponse class. + * Initializes a new instance of the RedisPatchSchedule class. * @constructor * Response to put/get patch schedules for redis cache. * @@ -455,7 +364,7 @@ export interface RedisPatchSchedulesRequest { * @member {array} scheduleEntries List of patch schedules for redis cache. * */ -export interface RedisPatchSchedulesResponse { +export interface RedisPatchSchedule { id?: string; name?: string; type?: string; diff --git a/lib/services/rediscachemanagement/lib/models/index.js b/lib/services/rediscachemanagement/lib/models/index.js index 669810ad77..d1c47e3dca 100644 --- a/lib/services/rediscachemanagement/lib/models/index.js +++ b/lib/services/rediscachemanagement/lib/models/index.js @@ -19,18 +19,15 @@ var msRestAzure = require('ms-rest-azure'); exports.BaseResource = msRestAzure.BaseResource; exports.CloudError = msRestAzure.CloudError; exports.Sku = require('./sku'); -exports.RedisProperties = require('./redisProperties'); exports.Resource = require('./resource'); -exports.RedisCreateOrUpdateParameters = require('./redisCreateOrUpdateParameters'); +exports.RedisCreateParameters = require('./redisCreateParameters'); +exports.RedisUpdateParameters = require('./redisUpdateParameters'); exports.RedisAccessKeys = require('./redisAccessKeys'); -exports.RedisResourceWithAccessKey = require('./redisResourceWithAccessKey'); exports.RedisResource = require('./redisResource'); -exports.RedisListKeysResult = require('./redisListKeysResult'); +exports.RedisListResult = require('./redisListResult'); exports.RedisRegenerateKeyParameters = require('./redisRegenerateKeyParameters'); exports.RedisRebootParameters = require('./redisRebootParameters'); exports.ExportRDBParameters = require('./exportRDBParameters'); exports.ImportRDBParameters = require('./importRDBParameters'); exports.ScheduleEntry = require('./scheduleEntry'); -exports.RedisPatchSchedulesRequest = require('./redisPatchSchedulesRequest'); -exports.RedisPatchSchedulesResponse = require('./redisPatchSchedulesResponse'); -exports.RedisListResult = require('./redisListResult'); +exports.RedisPatchSchedule = require('./redisPatchSchedule'); diff --git a/lib/services/rediscachemanagement/lib/models/redisAccessKeys.js b/lib/services/rediscachemanagement/lib/models/redisAccessKeys.js index f90cb6c447..ac726f91a0 100644 --- a/lib/services/rediscachemanagement/lib/models/redisAccessKeys.js +++ b/lib/services/rediscachemanagement/lib/models/redisAccessKeys.js @@ -42,6 +42,7 @@ RedisAccessKeys.prototype.mapper = function () { modelProperties: { primaryKey: { required: false, + readOnly: true, serializedName: 'primaryKey', type: { name: 'String' @@ -49,6 +50,7 @@ RedisAccessKeys.prototype.mapper = function () { }, secondaryKey: { required: false, + readOnly: true, serializedName: 'secondaryKey', type: { name: 'String' diff --git a/lib/services/rediscachemanagement/lib/models/redisCreateOrUpdateParameters.js b/lib/services/rediscachemanagement/lib/models/redisCreateParameters.js similarity index 83% rename from lib/services/rediscachemanagement/lib/models/redisCreateOrUpdateParameters.js rename to lib/services/rediscachemanagement/lib/models/redisCreateParameters.js index 4706442e04..89028be111 100644 --- a/lib/services/rediscachemanagement/lib/models/redisCreateOrUpdateParameters.js +++ b/lib/services/rediscachemanagement/lib/models/redisCreateParameters.js @@ -16,26 +16,10 @@ var util = require('util'); /** * @class - * Initializes a new instance of the RedisCreateOrUpdateParameters class. + * Initializes a new instance of the RedisCreateParameters class. * @constructor - * Parameters supplied to the CreateOrUpdate Redis operation. + * Parameters supplied to the Create Redis operation. * - * @member {string} [redisVersion] RedisVersion parameter has been deprecated. - * As such, it is no longer necessary to provide this parameter and any value - * specified is ignored. - * - * @member {object} sku What sku of redis cache to deploy. - * - * @member {string} [sku.name] What type of redis cache to deploy. Valid - * values: (Basic, Standard, Premium). Possible values include: 'Basic', - * 'Standard', 'Premium' - * - * @member {string} [sku.family] Which family to use. Valid values: (C, P). - * Possible values include: 'C', 'P' - * - * @member {number} [sku.capacity] What size of redis cache to deploy. Valid - * values: for C family (0, 1, 2, 3, 4, 5, 6), for P family (1, 2, 3, 4) - * * @member {object} [redisConfiguration] All Redis Settings. Few possible * keys: rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value * etc. @@ -55,26 +39,38 @@ var util = require('util'); * @member {string} [staticIP] Required when deploying a redis cache inside an * existing Azure Virtual Network. * + * @member {object} sku What sku of redis cache to deploy. + * + * @member {string} [sku.name] What type of redis cache to deploy. Valid + * values: (Basic, Standard, Premium). Possible values include: 'Basic', + * 'Standard', 'Premium' + * + * @member {string} [sku.family] Which family to use. Valid values: (C, P). + * Possible values include: 'C', 'P' + * + * @member {number} [sku.capacity] What size of redis cache to deploy. Valid + * values: for C family (0, 1, 2, 3, 4, 5, 6), for P family (1, 2, 3, 4) + * */ -function RedisCreateOrUpdateParameters() { - RedisCreateOrUpdateParameters['super_'].call(this); +function RedisCreateParameters() { + RedisCreateParameters['super_'].call(this); } -util.inherits(RedisCreateOrUpdateParameters, models['Resource']); +util.inherits(RedisCreateParameters, models['Resource']); /** - * Defines the metadata of RedisCreateOrUpdateParameters + * Defines the metadata of RedisCreateParameters * - * @returns {object} metadata of RedisCreateOrUpdateParameters + * @returns {object} metadata of RedisCreateParameters * */ -RedisCreateOrUpdateParameters.prototype.mapper = function () { +RedisCreateParameters.prototype.mapper = function () { return { required: false, - serializedName: 'RedisCreateOrUpdateParameters', + serializedName: 'RedisCreateParameters', type: { name: 'Composite', - className: 'RedisCreateOrUpdateParameters', + className: 'RedisCreateParameters', modelProperties: { id: { required: false, @@ -121,21 +117,6 @@ RedisCreateOrUpdateParameters.prototype.mapper = function () { } } }, - redisVersion: { - required: false, - serializedName: 'properties.redisVersion', - type: { - name: 'String' - } - }, - sku: { - required: true, - serializedName: 'properties.sku', - type: { - name: 'Composite', - className: 'Sku' - } - }, redisConfiguration: { required: false, serializedName: 'properties.redisConfiguration', @@ -197,10 +178,18 @@ RedisCreateOrUpdateParameters.prototype.mapper = function () { type: { name: 'String' } + }, + sku: { + required: true, + serializedName: 'properties.sku', + type: { + name: 'Composite', + className: 'Sku' + } } } } }; }; -module.exports = RedisCreateOrUpdateParameters; +module.exports = RedisCreateParameters; diff --git a/lib/services/rediscachemanagement/lib/models/redisListKeysResult.js b/lib/services/rediscachemanagement/lib/models/redisListKeysResult.js deleted file mode 100644 index 4c40fd890d..0000000000 --- a/lib/services/rediscachemanagement/lib/models/redisListKeysResult.js +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -/** - * @class - * Initializes a new instance of the RedisListKeysResult class. - * @constructor - * The response of redis list keys operation. - * - * @member {string} [primaryKey] The current primary key that clients can use - * to authenticate with redis cache. - * - * @member {string} [secondaryKey] The current secondary key that clients can - * use to authenticate with redis cache. - * - */ -function RedisListKeysResult() { -} - -/** - * Defines the metadata of RedisListKeysResult - * - * @returns {object} metadata of RedisListKeysResult - * - */ -RedisListKeysResult.prototype.mapper = function () { - return { - required: false, - serializedName: 'RedisListKeysResult', - type: { - name: 'Composite', - className: 'RedisListKeysResult', - modelProperties: { - primaryKey: { - required: false, - serializedName: 'primaryKey', - type: { - name: 'String' - } - }, - secondaryKey: { - required: false, - serializedName: 'secondaryKey', - type: { - name: 'String' - } - } - } - } - }; -}; - -module.exports = RedisListKeysResult; diff --git a/lib/services/rediscachemanagement/lib/models/redisPatchSchedulesResponse.js b/lib/services/rediscachemanagement/lib/models/redisPatchSchedule.js similarity index 82% rename from lib/services/rediscachemanagement/lib/models/redisPatchSchedulesResponse.js rename to lib/services/rediscachemanagement/lib/models/redisPatchSchedule.js index aa5d48c189..dc1c467cdc 100644 --- a/lib/services/rediscachemanagement/lib/models/redisPatchSchedulesResponse.js +++ b/lib/services/rediscachemanagement/lib/models/redisPatchSchedule.js @@ -16,7 +16,7 @@ var util = require('util'); /** * @class - * Initializes a new instance of the RedisPatchSchedulesResponse class. + * Initializes a new instance of the RedisPatchSchedule class. * @constructor * Response to put/get patch schedules for redis cache. * @@ -31,22 +31,22 @@ var util = require('util'); * @member {array} scheduleEntries List of patch schedules for redis cache. * */ -function RedisPatchSchedulesResponse() { +function RedisPatchSchedule() { } /** - * Defines the metadata of RedisPatchSchedulesResponse + * Defines the metadata of RedisPatchSchedule * - * @returns {object} metadata of RedisPatchSchedulesResponse + * @returns {object} metadata of RedisPatchSchedule * */ -RedisPatchSchedulesResponse.prototype.mapper = function () { +RedisPatchSchedule.prototype.mapper = function () { return { required: false, - serializedName: 'RedisPatchSchedulesResponse', + serializedName: 'RedisPatchSchedule', type: { name: 'Composite', - className: 'RedisPatchSchedulesResponse', + className: 'RedisPatchSchedule', modelProperties: { id: { required: false, @@ -74,6 +74,7 @@ RedisPatchSchedulesResponse.prototype.mapper = function () { }, location: { required: false, + readOnly: true, serializedName: 'location', type: { name: 'String' @@ -99,4 +100,4 @@ RedisPatchSchedulesResponse.prototype.mapper = function () { }; }; -module.exports = RedisPatchSchedulesResponse; +module.exports = RedisPatchSchedule; diff --git a/lib/services/rediscachemanagement/lib/models/redisPatchSchedulesRequest.js b/lib/services/rediscachemanagement/lib/models/redisPatchSchedulesRequest.js deleted file mode 100644 index e48c301132..0000000000 --- a/lib/services/rediscachemanagement/lib/models/redisPatchSchedulesRequest.js +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -var models = require('./index'); - -var util = require('util'); - -/** - * @class - * Initializes a new instance of the RedisPatchSchedulesRequest class. - * @constructor - * Parameters to set patch schedules for redis cache. - * - * @member {array} scheduleEntries List of patch schedules for redis cache. - * - */ -function RedisPatchSchedulesRequest() { -} - -/** - * Defines the metadata of RedisPatchSchedulesRequest - * - * @returns {object} metadata of RedisPatchSchedulesRequest - * - */ -RedisPatchSchedulesRequest.prototype.mapper = function () { - return { - required: false, - serializedName: 'RedisPatchSchedulesRequest', - type: { - name: 'Composite', - className: 'RedisPatchSchedulesRequest', - modelProperties: { - scheduleEntries: { - required: true, - serializedName: 'properties.scheduleEntries', - type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ScheduleEntryElementType', - type: { - name: 'Composite', - className: 'ScheduleEntry' - } - } - } - } - } - } - }; -}; - -module.exports = RedisPatchSchedulesRequest; diff --git a/lib/services/rediscachemanagement/lib/models/redisResource.js b/lib/services/rediscachemanagement/lib/models/redisResource.js index 6b5a24031e..97e8cb882f 100644 --- a/lib/services/rediscachemanagement/lib/models/redisResource.js +++ b/lib/services/rediscachemanagement/lib/models/redisResource.js @@ -20,21 +20,15 @@ var util = require('util'); * @constructor * A single redis item in List or Get Operation. * - * @member {string} [redisVersion] RedisVersion parameter has been deprecated. - * As such, it is no longer necessary to provide this parameter and any value - * specified is ignored. + * @member {string} [redisVersion] Redis Version. * - * @member {object} sku What sku of redis cache to deploy. + * @member {string} [provisioningState] Redis instance provisioning status * - * @member {string} [sku.name] What type of redis cache to deploy. Valid - * values: (Basic, Standard, Premium). Possible values include: 'Basic', - * 'Standard', 'Premium' + * @member {string} [hostName] Redis host name * - * @member {string} [sku.family] Which family to use. Valid values: (C, P). - * Possible values include: 'C', 'P' + * @member {number} [port] Redis non-ssl port * - * @member {number} [sku.capacity] What size of redis cache to deploy. Valid - * values: for C family (0, 1, 2, 3, 4, 5, 6), for P family (1, 2, 3, 4) + * @member {number} [sslPort] Redis ssl port * * @member {object} [redisConfiguration] All Redis Settings. Few possible * keys: rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value @@ -55,13 +49,17 @@ var util = require('util'); * @member {string} [staticIP] Required when deploying a redis cache inside an * existing Azure Virtual Network. * - * @member {string} [provisioningState] Redis instance provisioning status + * @member {object} sku What sku of redis cache to deploy. * - * @member {string} [hostName] Redis host name + * @member {string} [sku.name] What type of redis cache to deploy. Valid + * values: (Basic, Standard, Premium). Possible values include: 'Basic', + * 'Standard', 'Premium' * - * @member {number} [port] Redis non-ssl port + * @member {string} [sku.family] Which family to use. Valid values: (C, P). + * Possible values include: 'C', 'P' * - * @member {number} [sslPort] Redis ssl port + * @member {number} [sku.capacity] What size of redis cache to deploy. Valid + * values: for C family (0, 1, 2, 3, 4, 5, 6), for P family (1, 2, 3, 4) * */ function RedisResource() { @@ -131,17 +129,42 @@ RedisResource.prototype.mapper = function () { }, redisVersion: { required: false, + readOnly: true, serializedName: 'properties.redisVersion', type: { name: 'String' } }, - sku: { - required: true, - serializedName: 'properties.sku', + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', type: { - name: 'Composite', - className: 'Sku' + name: 'String' + } + }, + hostName: { + required: false, + readOnly: true, + serializedName: 'properties.hostName', + type: { + name: 'String' + } + }, + port: { + required: false, + readOnly: true, + serializedName: 'properties.port', + type: { + name: 'Number' + } + }, + sslPort: { + required: false, + readOnly: true, + serializedName: 'properties.sslPort', + type: { + name: 'Number' } }, redisConfiguration: { @@ -206,32 +229,12 @@ RedisResource.prototype.mapper = function () { name: 'String' } }, - provisioningState: { - required: false, - serializedName: 'properties.provisioningState', - type: { - name: 'String' - } - }, - hostName: { - required: false, - serializedName: 'properties.hostName', - type: { - name: 'String' - } - }, - port: { - required: false, - serializedName: 'properties.port', - type: { - name: 'Number' - } - }, - sslPort: { - required: false, - serializedName: 'properties.sslPort', + sku: { + required: true, + serializedName: 'properties.sku', type: { - name: 'Number' + name: 'Composite', + className: 'Sku' } } } diff --git a/lib/services/rediscachemanagement/lib/models/redisResourceWithAccessKey.js b/lib/services/rediscachemanagement/lib/models/redisResourceWithAccessKey.js deleted file mode 100644 index 7731437de2..0000000000 --- a/lib/services/rediscachemanagement/lib/models/redisResourceWithAccessKey.js +++ /dev/null @@ -1,258 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -'use strict'; - -var models = require('./index'); - -var util = require('util'); - -/** - * @class - * Initializes a new instance of the RedisResourceWithAccessKey class. - * @constructor - * A redis item in CreateOrUpdate Operation response. - * - * @member {string} [redisVersion] RedisVersion parameter has been deprecated. - * As such, it is no longer necessary to provide this parameter and any value - * specified is ignored. - * - * @member {object} sku What sku of redis cache to deploy. - * - * @member {string} [sku.name] What type of redis cache to deploy. Valid - * values: (Basic, Standard, Premium). Possible values include: 'Basic', - * 'Standard', 'Premium' - * - * @member {string} [sku.family] Which family to use. Valid values: (C, P). - * Possible values include: 'C', 'P' - * - * @member {number} [sku.capacity] What size of redis cache to deploy. Valid - * values: for C family (0, 1, 2, 3, 4, 5, 6), for P family (1, 2, 3, 4) - * - * @member {object} [redisConfiguration] All Redis Settings. Few possible - * keys: rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value - * etc. - * - * @member {boolean} [enableNonSslPort] If the value is true, then the non-ssl - * redis server port (6379) will be enabled. - * - * @member {object} [tenantSettings] tenantSettings - * - * @member {number} [shardCount] The number of shards to be created on a - * Premium Cluster Cache. - * - * @member {string} [subnetId] The full resource ID of a subnet in a virtual - * network to deploy the redis cache in. Example format: - * /subscriptions/{subid}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1 - * - * @member {string} [staticIP] Required when deploying a redis cache inside an - * existing Azure Virtual Network. - * - * @member {string} [provisioningState] Redis instance provisioning status - * - * @member {string} [hostName] Redis host name - * - * @member {number} [port] Redis non-ssl port - * - * @member {number} [sslPort] Redis ssl port - * - * @member {object} [accessKeys] Redis cache access keys. - * - * @member {string} [accessKeys.primaryKey] The current primary key that - * clients can use to authenticate with redis cache. - * - * @member {string} [accessKeys.secondaryKey] The current secondary key that - * clients can use to authenticate with redis cache. - * - */ -function RedisResourceWithAccessKey() { - RedisResourceWithAccessKey['super_'].call(this); -} - -util.inherits(RedisResourceWithAccessKey, models['Resource']); - -/** - * Defines the metadata of RedisResourceWithAccessKey - * - * @returns {object} metadata of RedisResourceWithAccessKey - * - */ -RedisResourceWithAccessKey.prototype.mapper = function () { - return { - required: false, - serializedName: 'RedisResourceWithAccessKey', - type: { - name: 'Composite', - className: 'RedisResourceWithAccessKey', - 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: true, - serializedName: 'location', - type: { - name: 'String' - } - }, - tags: { - required: false, - serializedName: 'tags', - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - redisVersion: { - required: false, - serializedName: 'properties.redisVersion', - type: { - name: 'String' - } - }, - sku: { - required: true, - serializedName: 'properties.sku', - type: { - name: 'Composite', - className: 'Sku' - } - }, - redisConfiguration: { - required: false, - serializedName: 'properties.redisConfiguration', - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - enableNonSslPort: { - required: false, - serializedName: 'properties.enableNonSslPort', - type: { - name: 'Boolean' - } - }, - tenantSettings: { - required: false, - serializedName: 'properties.tenantSettings', - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, - shardCount: { - required: false, - serializedName: 'properties.shardCount', - type: { - name: 'Number' - } - }, - subnetId: { - required: false, - serializedName: 'properties.subnetId', - constraints: { - Pattern: '^/subscriptions/[^/]*/resourceGroups/[^/]*/providers/Microsoft.(ClassicNetwork|Network)/virtualNetworks/[^/]*/subnets/[^/]*$' - }, - type: { - name: 'String' - } - }, - staticIP: { - required: false, - serializedName: 'properties.staticIP', - constraints: { - Pattern: '^\d+\.\d+\.\d+\.\d+$' - }, - type: { - name: 'String' - } - }, - provisioningState: { - required: false, - serializedName: 'properties.provisioningState', - type: { - name: 'String' - } - }, - hostName: { - required: false, - serializedName: 'properties.hostName', - type: { - name: 'String' - } - }, - port: { - required: false, - serializedName: 'properties.port', - type: { - name: 'Number' - } - }, - sslPort: { - required: false, - serializedName: 'properties.sslPort', - type: { - name: 'Number' - } - }, - accessKeys: { - required: false, - serializedName: 'properties.accessKeys', - type: { - name: 'Composite', - className: 'RedisAccessKeys' - } - } - } - } - }; -}; - -module.exports = RedisResourceWithAccessKey; diff --git a/lib/services/rediscachemanagement/lib/models/redisProperties.js b/lib/services/rediscachemanagement/lib/models/redisUpdateParameters.js similarity index 75% rename from lib/services/rediscachemanagement/lib/models/redisProperties.js rename to lib/services/rediscachemanagement/lib/models/redisUpdateParameters.js index f268a06b6a..4b9da1eaf8 100644 --- a/lib/services/rediscachemanagement/lib/models/redisProperties.js +++ b/lib/services/rediscachemanagement/lib/models/redisUpdateParameters.js @@ -14,26 +14,10 @@ var models = require('./index'); /** * @class - * Initializes a new instance of the RedisProperties class. + * Initializes a new instance of the RedisUpdateParameters class. * @constructor - * Properties supplied to CreateOrUpdate redis operation. + * Parameters supplied to the Update Redis operation. * - * @member {string} [redisVersion] RedisVersion parameter has been deprecated. - * As such, it is no longer necessary to provide this parameter and any value - * specified is ignored. - * - * @member {object} sku What sku of redis cache to deploy. - * - * @member {string} [sku.name] What type of redis cache to deploy. Valid - * values: (Basic, Standard, Premium). Possible values include: 'Basic', - * 'Standard', 'Premium' - * - * @member {string} [sku.family] Which family to use. Valid values: (C, P). - * Possible values include: 'C', 'P' - * - * @member {number} [sku.capacity] What size of redis cache to deploy. Valid - * values: for C family (0, 1, 2, 3, 4, 5, 6), for P family (1, 2, 3, 4) - * * @member {object} [redisConfiguration] All Redis Settings. Few possible * keys: rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value * etc. @@ -53,42 +37,41 @@ var models = require('./index'); * @member {string} [staticIP] Required when deploying a redis cache inside an * existing Azure Virtual Network. * + * @member {object} [sku] What sku of redis cache to deploy. + * + * @member {string} [sku.name] What type of redis cache to deploy. Valid + * values: (Basic, Standard, Premium). Possible values include: 'Basic', + * 'Standard', 'Premium' + * + * @member {string} [sku.family] Which family to use. Valid values: (C, P). + * Possible values include: 'C', 'P' + * + * @member {number} [sku.capacity] What size of redis cache to deploy. Valid + * values: for C family (0, 1, 2, 3, 4, 5, 6), for P family (1, 2, 3, 4) + * + * @member {object} [tags] Resource tags + * */ -function RedisProperties() { +function RedisUpdateParameters() { } /** - * Defines the metadata of RedisProperties + * Defines the metadata of RedisUpdateParameters * - * @returns {object} metadata of RedisProperties + * @returns {object} metadata of RedisUpdateParameters * */ -RedisProperties.prototype.mapper = function () { +RedisUpdateParameters.prototype.mapper = function () { return { required: false, - serializedName: 'RedisProperties', + serializedName: 'RedisUpdateParameters', type: { name: 'Composite', - className: 'RedisProperties', + className: 'RedisUpdateParameters', modelProperties: { - redisVersion: { - required: false, - serializedName: 'redisVersion', - type: { - name: 'String' - } - }, - sku: { - required: true, - serializedName: 'sku', - type: { - name: 'Composite', - className: 'Sku' - } - }, redisConfiguration: { required: false, - serializedName: 'redisConfiguration', + serializedName: 'properties.redisConfiguration', type: { name: 'Dictionary', value: { @@ -102,14 +85,14 @@ RedisProperties.prototype.mapper = function () { }, enableNonSslPort: { required: false, - serializedName: 'enableNonSslPort', + serializedName: 'properties.enableNonSslPort', type: { name: 'Boolean' } }, tenantSettings: { required: false, - serializedName: 'tenantSettings', + serializedName: 'properties.tenantSettings', type: { name: 'Dictionary', value: { @@ -123,14 +106,14 @@ RedisProperties.prototype.mapper = function () { }, shardCount: { required: false, - serializedName: 'shardCount', + serializedName: 'properties.shardCount', type: { name: 'Number' } }, subnetId: { required: false, - serializedName: 'subnetId', + serializedName: 'properties.subnetId', constraints: { Pattern: '^/subscriptions/[^/]*/resourceGroups/[^/]*/providers/Microsoft.(ClassicNetwork|Network)/virtualNetworks/[^/]*/subnets/[^/]*$' }, @@ -140,17 +123,39 @@ RedisProperties.prototype.mapper = function () { }, staticIP: { required: false, - serializedName: 'staticIP', + serializedName: 'properties.staticIP', constraints: { Pattern: '^\d+\.\d+\.\d+\.\d+$' }, type: { name: 'String' } + }, + sku: { + required: false, + serializedName: 'properties.sku', + type: { + name: 'Composite', + className: 'Sku' + } + }, + tags: { + required: false, + serializedName: 'properties.tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } } } } }; }; -module.exports = RedisProperties; +module.exports = RedisUpdateParameters; diff --git a/lib/services/rediscachemanagement/lib/models/resource.js b/lib/services/rediscachemanagement/lib/models/resource.js index 13827d365a..3c2b2459f7 100644 --- a/lib/services/rediscachemanagement/lib/models/resource.js +++ b/lib/services/rediscachemanagement/lib/models/resource.js @@ -18,6 +18,8 @@ var util = require('util'); * @class * Initializes a new instance of the Resource class. * @constructor + * The Resource definition. + * * @member {string} [id] Resource Id * * @member {string} [name] Resource name diff --git a/lib/services/rediscachemanagement/lib/models/scheduleEntry.js b/lib/services/rediscachemanagement/lib/models/scheduleEntry.js index b6987b34b5..595f5d4719 100644 --- a/lib/services/rediscachemanagement/lib/models/scheduleEntry.js +++ b/lib/services/rediscachemanagement/lib/models/scheduleEntry.js @@ -14,9 +14,11 @@ * @class * Initializes a new instance of the ScheduleEntry class. * @constructor + * Patch schedule entry for Premium Redis Cache. + * * @member {string} dayOfWeek Day of week when cache can be patched. Possible * values include: 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', - * 'Saturday', 'Sunday' + * 'Saturday', 'Sunday', 'Everyday', 'Weekend' * * @member {number} startHourUtc Start hour after which cache patching can * start. @@ -46,7 +48,8 @@ ScheduleEntry.prototype.mapper = function () { required: true, serializedName: 'dayOfWeek', type: { - name: 'String' + name: 'Enum', + allowedValues: [ 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday', 'Everyday', 'Weekend' ] } }, startHourUtc: { diff --git a/lib/services/rediscachemanagement/lib/operations/index.d.ts b/lib/services/rediscachemanagement/lib/operations/index.d.ts index 0289d26735..6fde605fce 100644 --- a/lib/services/rediscachemanagement/lib/operations/index.d.ts +++ b/lib/services/rediscachemanagement/lib/operations/index.d.ts @@ -21,19 +21,35 @@ import * as models from '../models'; export interface Redis { /** - * Create a redis cache, or replace (overwrite/recreate, with potential - * downtime) an existing cache + * Create or replace (overwrite/recreate, with potential downtime) an existing + * redis cache * * @param {string} resourceGroupName The name of the resource group. * * @param {string} name The name of the redis cache. * - * @param {object} parameters Parameters supplied to the CreateOrUpdate redis + * @param {object} parameters Parameters supplied to the Create redis * operation. * - * @param {string} [parameters.redisVersion] RedisVersion parameter has been - * deprecated. As such, it is no longer necessary to provide this parameter - * and any value specified is ignored. + * @param {object} [parameters.redisConfiguration] All Redis Settings. Few + * possible keys: + * rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value + * etc. + * + * @param {boolean} [parameters.enableNonSslPort] If the value is true, then + * the non-ssl redis server port (6379) will be enabled. + * + * @param {object} [parameters.tenantSettings] tenantSettings + * + * @param {number} [parameters.shardCount] The number of shards to be created + * on a Premium Cluster Cache. + * + * @param {string} [parameters.subnetId] The full resource ID of a subnet in a + * virtual network to deploy the redis cache in. Example format: + * /subscriptions/{subid}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1 + * + * @param {string} [parameters.staticIP] Required when deploying a redis cache + * inside an existing Azure Virtual Network. * * @param {object} parameters.sku What sku of redis cache to deploy. * @@ -47,6 +63,31 @@ export interface Redis { * @param {number} parameters.sku.capacity What size of redis cache to deploy. * Valid values: for C family (0, 1, 2, 3, 4, 5, 6), for P family (1, 2, 3, 4) * + * @param {string} parameters.location Resource location + * + * @param {object} [parameters.tags] Resource tags + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [callback] callback function; see ServiceCallback + * doc in ms-rest index.d.ts for details + */ + create(resourceGroupName: string, name: string, parameters: models.RedisCreateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + create(resourceGroupName: string, name: string, parameters: models.RedisCreateParameters, callback: ServiceCallback): void; + + /** + * Update an existing Redis cache + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} name The name of the redis cache. + * + * @param {object} parameters Parameters supplied to the Update redis + * operation. + * * @param {object} [parameters.redisConfiguration] All Redis Settings. Few * possible keys: * rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value @@ -67,7 +108,17 @@ export interface Redis { * @param {string} [parameters.staticIP] Required when deploying a redis cache * inside an existing Azure Virtual Network. * - * @param {string} parameters.location Resource location + * @param {object} [parameters.sku] What sku of redis cache to deploy. + * + * @param {string} parameters.sku.name What type of redis cache to deploy. + * Valid values: (Basic, Standard, Premium). Possible values include: + * 'Basic', 'Standard', 'Premium' + * + * @param {string} parameters.sku.family Which family to use. Valid values: + * (C, P). Possible values include: 'C', 'P' + * + * @param {number} parameters.sku.capacity What size of redis cache to deploy. + * Valid values: for C family (0, 1, 2, 3, 4, 5, 6), for P family (1, 2, 3, 4) * * @param {object} [parameters.tags] Resource tags * @@ -79,8 +130,8 @@ export interface Redis { * @param {ServiceCallback} [callback] callback function; see ServiceCallback * doc in ms-rest index.d.ts for details */ - createOrUpdate(resourceGroupName: string, name: string, parameters: models.RedisCreateOrUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, name: string, parameters: models.RedisCreateOrUpdateParameters, callback: ServiceCallback): void; + update(resourceGroupName: string, name: string, parameters: models.RedisUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + update(resourceGroupName: string, name: string, parameters: models.RedisUpdateParameters, callback: ServiceCallback): void; /** * Deletes a redis cache. This operation takes a while to complete. @@ -164,8 +215,8 @@ export interface Redis { * @param {ServiceCallback} [callback] callback function; see ServiceCallback * doc in ms-rest index.d.ts for details */ - listKeys(resourceGroupName: string, name: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - listKeys(resourceGroupName: string, name: string, callback: ServiceCallback): void; + listKeys(resourceGroupName: string, name: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listKeys(resourceGroupName: string, name: string, callback: ServiceCallback): void; /** * Regenerate redis cache's access keys. This operation requires write @@ -186,8 +237,8 @@ export interface Redis { * @param {ServiceCallback} [callback] callback function; see ServiceCallback * doc in ms-rest index.d.ts for details */ - regenerateKey(resourceGroupName: string, name: string, keyType: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - regenerateKey(resourceGroupName: string, name: string, keyType: string, callback: ServiceCallback): void; + regenerateKey(resourceGroupName: string, name: string, keyType: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + regenerateKey(resourceGroupName: string, name: string, keyType: string, callback: ServiceCallback): void; /** * Reboot specified redis node(s). This operation requires write permission to @@ -238,8 +289,8 @@ export interface Redis { * @param {ServiceCallback} [callback] callback function; see ServiceCallback * doc in ms-rest index.d.ts for details */ - importMethod(resourceGroupName: string, name: string, parameters: models.ImportRDBParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - importMethod(resourceGroupName: string, name: string, parameters: models.ImportRDBParameters, callback: ServiceCallback): void; + importData(resourceGroupName: string, name: string, parameters: models.ImportRDBParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + importData(resourceGroupName: string, name: string, parameters: models.ImportRDBParameters, callback: ServiceCallback): void; /** * Import data into redis cache. @@ -248,11 +299,144 @@ export interface Redis { * * @param {string} name The name of the redis cache. * - * @param {object} parameters Parameters for redis import operation. + * @param {object} parameters Parameters for redis export operation. * * @param {string} [parameters.format] File format. * - * @param {array} parameters.files files to import + * @param {string} parameters.prefix Prefix to use for exported files. + * + * @param {string} parameters.container Container name to export to. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [callback] callback function; see ServiceCallback + * doc in ms-rest index.d.ts for details + */ + exportData(resourceGroupName: string, name: string, parameters: models.ExportRDBParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + exportData(resourceGroupName: string, name: string, parameters: models.ExportRDBParameters, callback: ServiceCallback): void; + + /** + * Create or replace (overwrite/recreate, with potential downtime) an existing + * redis cache + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} name The name of the redis cache. + * + * @param {object} parameters Parameters supplied to the Create redis + * operation. + * + * @param {object} [parameters.redisConfiguration] All Redis Settings. Few + * possible keys: + * rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value + * etc. + * + * @param {boolean} [parameters.enableNonSslPort] If the value is true, then + * the non-ssl redis server port (6379) will be enabled. + * + * @param {object} [parameters.tenantSettings] tenantSettings + * + * @param {number} [parameters.shardCount] The number of shards to be created + * on a Premium Cluster Cache. + * + * @param {string} [parameters.subnetId] The full resource ID of a subnet in a + * virtual network to deploy the redis cache in. Example format: + * /subscriptions/{subid}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1 + * + * @param {string} [parameters.staticIP] Required when deploying a redis cache + * inside an existing Azure Virtual Network. + * + * @param {object} parameters.sku What sku of redis cache to deploy. + * + * @param {string} parameters.sku.name What type of redis cache to deploy. + * Valid values: (Basic, Standard, Premium). Possible values include: + * 'Basic', 'Standard', 'Premium' + * + * @param {string} parameters.sku.family Which family to use. Valid values: + * (C, P). Possible values include: 'C', 'P' + * + * @param {number} parameters.sku.capacity What size of redis cache to deploy. + * Valid values: for C family (0, 1, 2, 3, 4, 5, 6), for P family (1, 2, 3, 4) + * + * @param {string} parameters.location Resource location + * + * @param {object} [parameters.tags] Resource tags + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [callback] callback function; see ServiceCallback + * doc in ms-rest index.d.ts for details + */ + beginCreate(resourceGroupName: string, name: string, parameters: models.RedisCreateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginCreate(resourceGroupName: string, name: string, parameters: models.RedisCreateParameters, callback: ServiceCallback): void; + + /** + * Update an existing Redis cache + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} name The name of the redis cache. + * + * @param {object} parameters Parameters supplied to the Update redis + * operation. + * + * @param {object} [parameters.redisConfiguration] All Redis Settings. Few + * possible keys: + * rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value + * etc. + * + * @param {boolean} [parameters.enableNonSslPort] If the value is true, then + * the non-ssl redis server port (6379) will be enabled. + * + * @param {object} [parameters.tenantSettings] tenantSettings + * + * @param {number} [parameters.shardCount] The number of shards to be created + * on a Premium Cluster Cache. + * + * @param {string} [parameters.subnetId] The full resource ID of a subnet in a + * virtual network to deploy the redis cache in. Example format: + * /subscriptions/{subid}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1 + * + * @param {string} [parameters.staticIP] Required when deploying a redis cache + * inside an existing Azure Virtual Network. + * + * @param {object} [parameters.sku] What sku of redis cache to deploy. + * + * @param {string} parameters.sku.name What type of redis cache to deploy. + * Valid values: (Basic, Standard, Premium). Possible values include: + * 'Basic', 'Standard', 'Premium' + * + * @param {string} parameters.sku.family Which family to use. Valid values: + * (C, P). Possible values include: 'C', 'P' + * + * @param {number} parameters.sku.capacity What size of redis cache to deploy. + * Valid values: for C family (0, 1, 2, 3, 4, 5, 6), for P family (1, 2, 3, 4) + * + * @param {object} [parameters.tags] Resource tags + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [callback] callback function; see ServiceCallback + * doc in ms-rest index.d.ts for details + */ + beginUpdate(resourceGroupName: string, name: string, parameters: models.RedisUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginUpdate(resourceGroupName: string, name: string, parameters: models.RedisUpdateParameters, callback: ServiceCallback): void; + + /** + * Deletes a redis cache. This operation takes a while to complete. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} name The name of the redis cache. * * @param {object} [options] Optional Parameters. * @@ -262,8 +446,8 @@ export interface Redis { * @param {ServiceCallback} [callback] callback function; see ServiceCallback * doc in ms-rest index.d.ts for details */ - beginImportMethod(resourceGroupName: string, name: string, parameters: models.ImportRDBParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - beginImportMethod(resourceGroupName: string, name: string, parameters: models.ImportRDBParameters, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, name: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, name: string, callback: ServiceCallback): void; /** * Import data into redis cache. @@ -272,13 +456,11 @@ export interface Redis { * * @param {string} name The name of the redis cache. * - * @param {object} parameters Parameters for redis export operation. + * @param {object} parameters Parameters for redis import operation. * * @param {string} [parameters.format] File format. * - * @param {string} parameters.prefix Prifix to use for exported files. - * - * @param {string} parameters.container Container name to export to. + * @param {array} parameters.files files to import * * @param {object} [options] Optional Parameters. * @@ -288,8 +470,8 @@ export interface Redis { * @param {ServiceCallback} [callback] callback function; see ServiceCallback * doc in ms-rest index.d.ts for details */ - exportMethod(resourceGroupName: string, name: string, parameters: models.ExportRDBParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - exportMethod(resourceGroupName: string, name: string, parameters: models.ExportRDBParameters, callback: ServiceCallback): void; + beginImportData(resourceGroupName: string, name: string, parameters: models.ImportRDBParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginImportData(resourceGroupName: string, name: string, parameters: models.ImportRDBParameters, callback: ServiceCallback): void; /** * Import data into redis cache. @@ -302,7 +484,7 @@ export interface Redis { * * @param {string} [parameters.format] File format. * - * @param {string} parameters.prefix Prifix to use for exported files. + * @param {string} parameters.prefix Prefix to use for exported files. * * @param {string} parameters.container Container name to export to. * @@ -314,8 +496,8 @@ export interface Redis { * @param {ServiceCallback} [callback] callback function; see ServiceCallback * doc in ms-rest index.d.ts for details */ - beginExportMethod(resourceGroupName: string, name: string, parameters: models.ExportRDBParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - beginExportMethod(resourceGroupName: string, name: string, parameters: models.ExportRDBParameters, callback: ServiceCallback): void; + beginExportData(resourceGroupName: string, name: string, parameters: models.ExportRDBParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginExportData(resourceGroupName: string, name: string, parameters: models.ExportRDBParameters, callback: ServiceCallback): void; /** * Gets all redis caches in a resource group. @@ -377,8 +559,8 @@ export interface PatchSchedules { * @param {ServiceCallback} [callback] callback function; see ServiceCallback * doc in ms-rest index.d.ts for details */ - createOrUpdate(resourceGroupName: string, name: string, scheduleEntries: models.ScheduleEntry[], options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, name: string, scheduleEntries: models.ScheduleEntry[], callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, name: string, scheduleEntries: models.ScheduleEntry[], options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, name: string, scheduleEntries: models.ScheduleEntry[], callback: ServiceCallback): void; /** * Deletes the patching schedule for redis cache. @@ -413,6 +595,6 @@ export interface PatchSchedules { * @param {ServiceCallback} [callback] callback function; see ServiceCallback * doc in ms-rest index.d.ts for details */ - get(resourceGroupName: string, name: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - get(resourceGroupName: string, name: string, callback: ServiceCallback): void; + get(resourceGroupName: string, name: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, name: string, callback: ServiceCallback): void; } diff --git a/lib/services/rediscachemanagement/lib/operations/patchSchedules.js b/lib/services/rediscachemanagement/lib/operations/patchSchedules.js index 11654c3821..53227c3bf9 100644 --- a/lib/services/rediscachemanagement/lib/operations/patchSchedules.js +++ b/lib/services/rediscachemanagement/lib/operations/patchSchedules.js @@ -50,8 +50,7 @@ function PatchSchedules(client) { * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object. - * See {@link RedisPatchSchedulesResponse} for more - * information. + * See {@link RedisPatchSchedule} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * @@ -86,21 +85,22 @@ PatchSchedules.prototype.createOrUpdate = function (resourceGroupName, name, sch } catch (error) { return callback(error); } - var parameters; - if (scheduleEntries !== null && scheduleEntries !== undefined) { - parameters = new client.models['RedisPatchSchedulesRequest'](); + var parameters = new client.models['RedisPatchSchedule'](); + try { + if (scheduleEntries !== null && scheduleEntries !== undefined) + { parameters.scheduleEntries = scheduleEntries; + } + } catch (error) { + return callback(error); } // Construct URL - var requestUrl = this.client.baseUri + - '//subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/patchSchedules/default'; + var baseUrl = this.client.baseUri; + var requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/patchSchedules/default'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - // trim all duplicate forward slashes in the url - var regex = /([^:]\/)\/+/gi; - requestUrl = requestUrl.replace(regex, '$1'); var queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { @@ -132,7 +132,7 @@ PatchSchedules.prototype.createOrUpdate = function (resourceGroupName, name, sch var requestModel = null; try { if (parameters !== null && parameters !== undefined) { - var requestModelMapper = new client.models['RedisPatchSchedulesRequest']().mapper(); + var requestModelMapper = new client.models['RedisPatchSchedule']().mapper(); requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); requestContent = JSON.stringify(requestModel); } @@ -183,7 +183,7 @@ PatchSchedules.prototype.createOrUpdate = function (resourceGroupName, name, sch parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - var resultMapper = new client.models['RedisPatchSchedulesResponse']().mapper(); + var resultMapper = new client.models['RedisPatchSchedule']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -253,14 +253,11 @@ PatchSchedules.prototype.deleteMethod = function (resourceGroupName, name, optio } // Construct URL - var requestUrl = this.client.baseUri + - '//subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/patchSchedules/default'; + var baseUrl = this.client.baseUri; + var requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/patchSchedules/default'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - // trim all duplicate forward slashes in the url - var regex = /([^:]\/)\/+/gi; - requestUrl = requestUrl.replace(regex, '$1'); var queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { @@ -342,8 +339,7 @@ PatchSchedules.prototype.deleteMethod = function (resourceGroupName, name, optio * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object. - * See {@link RedisPatchSchedulesResponse} for more - * information. + * See {@link RedisPatchSchedule} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * @@ -380,14 +376,11 @@ PatchSchedules.prototype.get = function (resourceGroupName, name, options, callb } // Construct URL - var requestUrl = this.client.baseUri + - '//subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/patchSchedules/default'; + var baseUrl = this.client.baseUri; + var requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/patchSchedules/default'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - // trim all duplicate forward slashes in the url - var regex = /([^:]\/)\/+/gi; - requestUrl = requestUrl.replace(regex, '$1'); var queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { @@ -421,7 +414,7 @@ PatchSchedules.prototype.get = function (resourceGroupName, name, options, callb return callback(err); } var statusCode = response.statusCode; - if (statusCode !== 200) { + if (statusCode !== 200 && statusCode !== 404) { var error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -456,7 +449,7 @@ PatchSchedules.prototype.get = function (resourceGroupName, name, options, callb parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - var resultMapper = new client.models['RedisPatchSchedulesResponse']().mapper(); + var resultMapper = new client.models['RedisPatchSchedule']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { diff --git a/lib/services/rediscachemanagement/lib/operations/redis.js b/lib/services/rediscachemanagement/lib/operations/redis.js index a6a20d597b..408e7a5bca 100644 --- a/lib/services/rediscachemanagement/lib/operations/redis.js +++ b/lib/services/rediscachemanagement/lib/operations/redis.js @@ -30,19 +30,36 @@ function Redis(client) { } /** - * Create a redis cache, or replace (overwrite/recreate, with potential - * downtime) an existing cache + * + * Create or replace (overwrite/recreate, with potential downtime) an existing + * redis cache * * @param {string} resourceGroupName The name of the resource group. * * @param {string} name The name of the redis cache. * - * @param {object} parameters Parameters supplied to the CreateOrUpdate redis + * @param {object} parameters Parameters supplied to the Create redis * operation. * - * @param {string} [parameters.redisVersion] RedisVersion parameter has been - * deprecated. As such, it is no longer necessary to provide this parameter - * and any value specified is ignored. + * @param {object} [parameters.redisConfiguration] All Redis Settings. Few + * possible keys: + * rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value + * etc. + * + * @param {boolean} [parameters.enableNonSslPort] If the value is true, then + * the non-ssl redis server port (6379) will be enabled. + * + * @param {object} [parameters.tenantSettings] tenantSettings + * + * @param {number} [parameters.shardCount] The number of shards to be created + * on a Premium Cluster Cache. + * + * @param {string} [parameters.subnetId] The full resource ID of a subnet in a + * virtual network to deploy the redis cache in. Example format: + * /subscriptions/{subid}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1 + * + * @param {string} [parameters.staticIP] Required when deploying a redis cache + * inside an existing Azure Virtual Network. * * @param {object} parameters.sku What sku of redis cache to deploy. * @@ -56,6 +73,89 @@ function Redis(client) { * @param {number} parameters.sku.capacity What size of redis cache to deploy. * Valid values: for C family (0, 1, 2, 3, 4, 5, 6), for P family (1, 2, 3, 4) * + * @param {string} parameters.location Resource location + * + * @param {object} [parameters.tags] Resource tags + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object. + * See {@link RedisResource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +Redis.prototype.create = function (resourceGroupName, name, parameters, options, callback) { + var 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, name, parameters, options, function (err, parsedResult, httpRequest, response){ + if (err) return callback(err); + + var initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, function (err, pollingResult) { + if (err) return callback(err); + + // Create Result + var result = null; + httpRequest = pollingResult.request; + response = pollingResult.response; + var responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + var parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + var resultMapper = new client.models['RedisResource']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody)); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +}; + +/** + * + * Update an existing Redis cache + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} name The name of the redis cache. + * + * @param {object} parameters Parameters supplied to the Update redis + * operation. + * * @param {object} [parameters.redisConfiguration] All Redis Settings. Few * possible keys: * rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value @@ -76,7 +176,17 @@ function Redis(client) { * @param {string} [parameters.staticIP] Required when deploying a redis cache * inside an existing Azure Virtual Network. * - * @param {string} parameters.location Resource location + * @param {object} [parameters.sku] What sku of redis cache to deploy. + * + * @param {string} parameters.sku.name What type of redis cache to deploy. + * Valid values: (Basic, Standard, Premium). Possible values include: + * 'Basic', 'Standard', 'Premium' + * + * @param {string} parameters.sku.family Which family to use. Valid values: + * (C, P). Possible values include: 'C', 'P' + * + * @param {number} parameters.sku.capacity What size of redis cache to deploy. + * Valid values: for C family (0, 1, 2, 3, 4, 5, 6), for P family (1, 2, 3, 4) * * @param {object} [parameters.tags] Resource tags * @@ -92,14 +202,149 @@ function Redis(client) { * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object. - * See {@link RedisResourceWithAccessKey} for more - * information. + * See {@link RedisResource} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +Redis.prototype.update = function (resourceGroupName, name, parameters, options, callback) { + var 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, name, parameters, options, function (err, parsedResult, httpRequest, response){ + if (err) return callback(err); + + var initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, function (err, pollingResult) { + if (err) return callback(err); + + // Create Result + var result = null; + httpRequest = pollingResult.request; + response = pollingResult.response; + var responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + var parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + var resultMapper = new client.models['RedisResource']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody)); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +}; + +/** + * + * Deletes a redis cache. This operation takes a while to complete. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} name The name of the redis cache. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} 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. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +Redis.prototype.deleteMethod = function (resourceGroupName, name, options, callback) { + var 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, name, options, function (err, parsedResult, httpRequest, response){ + if (err) return callback(err); + + var initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, function (err, pollingResult) { + if (err) return callback(err); + + // Create Result + var result = null; + httpRequest = pollingResult.request; + response = pollingResult.response; + var responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +}; + +/** + * Gets a redis cache (resource description). + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} name The name of the redis cache. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object. + * See {@link RedisResource} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -Redis.prototype.createOrUpdate = function (resourceGroupName, name, parameters, options, callback) { +Redis.prototype.get = function (resourceGroupName, name, options, callback) { var client = this.client; if(!callback && typeof options === 'function') { callback = options; @@ -116,9 +361,6 @@ Redis.prototype.createOrUpdate = function (resourceGroupName, name, parameters, if (name === null || name === undefined || typeof name.valueOf() !== 'string') { throw new Error('name cannot be null or undefined and it must be of type string.'); } - if (parameters === null || parameters === undefined) { - throw new Error('parameters cannot be null or undefined.'); - } if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); } @@ -133,14 +375,11 @@ Redis.prototype.createOrUpdate = function (resourceGroupName, name, parameters, } // Construct URL - var requestUrl = this.client.baseUri + - '//subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}'; + var baseUrl = this.client.baseUri; + var requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - // trim all duplicate forward slashes in the url - var regex = /([^:]\/)\/+/gi; - requestUrl = requestUrl.replace(regex, '$1'); var queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { @@ -149,7 +388,7 @@ Redis.prototype.createOrUpdate = function (resourceGroupName, name, parameters, // Create HTTP transport objects var httpRequest = new WebResource(); - httpRequest.method = 'PUT'; + httpRequest.method = 'GET'; httpRequest.headers = {}; httpRequest.url = requestUrl; // Set Headers @@ -167,28 +406,14 @@ Redis.prototype.createOrUpdate = function (resourceGroupName, name, parameters, } } httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; - // Serialize Request - var requestContent = null; - var requestModel = null; - try { - if (parameters !== null && parameters !== undefined) { - var requestModelMapper = new client.models['RedisCreateOrUpdateParameters']().mapper(); - requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - var serializationError = new Error(util.format('Error "%s" occurred in serializing the ' + - 'payload - "%s"', error.message, util.inspect(parameters, {depth: null}))); - return callback(serializationError); - } - httpRequest.body = requestContent; + httpRequest.body = null; // Send Request return client.pipeline(httpRequest, function (err, response, responseBody) { if (err) { return callback(err); } var statusCode = response.statusCode; - if (statusCode !== 201 && statusCode !== 200) { + if (statusCode !== 200) { var error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -217,13 +442,13 @@ Redis.prototype.createOrUpdate = function (resourceGroupName, name, parameters, var result = null; if (responseBody === '') responseBody = null; // Deserialize Response - if (statusCode === 201) { + if (statusCode === 200) { var parsedResponse = null; try { parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - var resultMapper = new client.models['RedisResourceWithAccessKey']().mapper(); + var resultMapper = new client.models['RedisResource']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -233,6 +458,127 @@ Redis.prototype.createOrUpdate = function (resourceGroupName, name, parameters, return callback(deserializationError); } } + + return callback(null, result, httpRequest, response); + }); +}; + +/** + * Gets all redis caches in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object. + * See {@link RedisListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +Redis.prototype.listByResourceGroup = function (resourceGroupName, options, callback) { + var client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + var baseUrl = this.client.baseUri; + var requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + var queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + var httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.headers = {}; + httpRequest.url = requestUrl; + // Set Headers + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(var headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, function (err, response, responseBody) { + if (err) { + return callback(err); + } + var statusCode = response.statusCode; + if (statusCode !== 200) { + var error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + var 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) { + var resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = util.format('Error "%s" occurred in deserializing the responseBody ' + + '- "%s" for the default response.', defaultError.message, responseBody); + return callback(error); + } + return callback(error); + } + // Create Result + var result = null; + if (responseBody === '') responseBody = null; // Deserialize Response if (statusCode === 200) { var parsedResponse = null; @@ -240,14 +586,14 @@ Redis.prototype.createOrUpdate = function (resourceGroupName, name, parameters, parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - var resultMapper = new client.models['RedisResourceWithAccessKey']().mapper(); + var resultMapper = new client.models['RedisListResult']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { - var deserializationError1 = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody)); - deserializationError1.request = msRest.stripRequest(httpRequest); - deserializationError1.response = msRest.stripResponse(response); - return callback(deserializationError1); + var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody)); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); } } @@ -256,12 +602,8 @@ Redis.prototype.createOrUpdate = function (resourceGroupName, name, parameters, }; /** - * Deletes a redis cache. This operation takes a while to complete. + * Gets all redis caches in the specified subscription. * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} name The name of the redis cache. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -273,13 +615,14 @@ Redis.prototype.createOrUpdate = function (resourceGroupName, name, parameters, * * {Error} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object. + * {object} [result] - The deserialized result object. + * See {@link RedisListResult} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -Redis.prototype.deleteMethod = function (resourceGroupName, name, options, callback) { +Redis.prototype.list = function (options, callback) { var client = this.client; if(!callback && typeof options === 'function') { callback = options; @@ -290,12 +633,6 @@ Redis.prototype.deleteMethod = function (resourceGroupName, name, options, callb } // Validate try { - if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { - throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); - } - if (name === null || name === undefined || typeof name.valueOf() !== 'string') { - throw new Error('name 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.'); } @@ -310,14 +647,9 @@ Redis.prototype.deleteMethod = function (resourceGroupName, name, options, callb } // Construct URL - var requestUrl = this.client.baseUri + - '//subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); + var baseUrl = this.client.baseUri; + var requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Cache/Redis/'; requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - // trim all duplicate forward slashes in the url - var regex = /([^:]\/)\/+/gi; - requestUrl = requestUrl.replace(regex, '$1'); var queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { @@ -326,7 +658,7 @@ Redis.prototype.deleteMethod = function (resourceGroupName, name, options, callb // Create HTTP transport objects var httpRequest = new WebResource(); - httpRequest.method = 'DELETE'; + httpRequest.method = 'GET'; httpRequest.headers = {}; httpRequest.url = requestUrl; // Set Headers @@ -351,7 +683,7 @@ Redis.prototype.deleteMethod = function (resourceGroupName, name, options, callb return callback(err); } var statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 204) { + if (statusCode !== 200) { var error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -365,6 +697,10 @@ Redis.prototype.deleteMethod = function (resourceGroupName, name, options, callb if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + var resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } } catch (defaultError) { error.message = util.format('Error "%s" occurred in deserializing the responseBody ' + '- "%s" for the default response.', defaultError.message, responseBody); @@ -375,13 +711,31 @@ Redis.prototype.deleteMethod = function (resourceGroupName, name, options, callb // Create Result var result = null; if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + var parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + var resultMapper = new client.models['RedisListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody)); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } return callback(null, result, httpRequest, response); }); }; /** - * Gets a redis cache (resource description). + * Retrieve a redis cache's access keys. This operation requires write + * permission to the cache resource. * * @param {string} resourceGroupName The name of the resource group. * @@ -399,13 +753,13 @@ Redis.prototype.deleteMethod = function (resourceGroupName, name, options, callb * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object. - * See {@link RedisResource} for more information. + * See {@link RedisAccessKeys} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -Redis.prototype.get = function (resourceGroupName, name, options, callback) { +Redis.prototype.listKeys = function (resourceGroupName, name, options, callback) { var client = this.client; if(!callback && typeof options === 'function') { callback = options; @@ -436,14 +790,11 @@ Redis.prototype.get = function (resourceGroupName, name, options, callback) { } // Construct URL - var requestUrl = this.client.baseUri + - '//subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}'; + var baseUrl = this.client.baseUri; + var requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/listKeys'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - // trim all duplicate forward slashes in the url - var regex = /([^:]\/)\/+/gi; - requestUrl = requestUrl.replace(regex, '$1'); var queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { @@ -452,7 +803,7 @@ Redis.prototype.get = function (resourceGroupName, name, options, callback) { // Create HTTP transport objects var httpRequest = new WebResource(); - httpRequest.method = 'GET'; + httpRequest.method = 'POST'; httpRequest.headers = {}; httpRequest.url = requestUrl; // Set Headers @@ -512,7 +863,7 @@ Redis.prototype.get = function (resourceGroupName, name, options, callback) { parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - var resultMapper = new client.models['RedisResource']().mapper(); + var resultMapper = new client.models['RedisAccessKeys']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -528,10 +879,16 @@ Redis.prototype.get = function (resourceGroupName, name, options, callback) { }; /** - * Gets all redis caches in a resource group. + * Regenerate redis cache's access keys. This operation requires write + * permission to the cache resource. * * @param {string} resourceGroupName The name of the resource group. * + * @param {string} name The name of the redis cache. + * + * @param {string} keyType Which redis access key to reset. Possible values + * include: 'Primary', 'Secondary' + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -544,13 +901,13 @@ Redis.prototype.get = function (resourceGroupName, name, options, callback) { * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object. - * See {@link RedisListResult} for more information. + * See {@link RedisAccessKeys} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -Redis.prototype.listByResourceGroup = function (resourceGroupName, options, callback) { +Redis.prototype.regenerateKey = function (resourceGroupName, name, keyType, options, callback) { var client = this.client; if(!callback && typeof options === 'function') { callback = options; @@ -564,27 +921,41 @@ Redis.prototype.listByResourceGroup = function (resourceGroupName, options, call if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } + if (name === null || name === undefined || typeof name.valueOf() !== 'string') { + throw new Error('name 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 (keyType) { + var allowedValues = [ 'Primary', 'Secondary' ]; + if (!allowedValues.some( function(item) { return item === keyType; })) { + throw new Error(keyType + ' is not a valid value. The valid values are: ' + allowedValues); + } + } else { + throw new Error('keyType 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); } + var parameters; + if (keyType !== null && keyType !== undefined) { + parameters = new client.models['RedisRegenerateKeyParameters'](); + parameters.keyType = keyType; + } // Construct URL - var requestUrl = this.client.baseUri + - '//subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/'; + var baseUrl = this.client.baseUri; + var requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/regenerateKey'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - // trim all duplicate forward slashes in the url - var regex = /([^:]\/)\/+/gi; - requestUrl = requestUrl.replace(regex, '$1'); var queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { @@ -593,7 +964,7 @@ Redis.prototype.listByResourceGroup = function (resourceGroupName, options, call // Create HTTP transport objects var httpRequest = new WebResource(); - httpRequest.method = 'GET'; + httpRequest.method = 'POST'; httpRequest.headers = {}; httpRequest.url = requestUrl; // Set Headers @@ -611,7 +982,21 @@ Redis.prototype.listByResourceGroup = function (resourceGroupName, options, call } } httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; - httpRequest.body = null; + // Serialize Request + var requestContent = null; + var requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + var requestModelMapper = new client.models['RedisRegenerateKeyParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + var serializationError = new Error(util.format('Error "%s" occurred in serializing the ' + + 'payload - "%s"', error.message, util.inspect(parameters, {depth: null}))); + return callback(serializationError); + } + httpRequest.body = requestContent; // Send Request return client.pipeline(httpRequest, function (err, response, responseBody) { if (err) { @@ -653,7 +1038,7 @@ Redis.prototype.listByResourceGroup = function (resourceGroupName, options, call parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - var resultMapper = new client.models['RedisListResult']().mapper(); + var resultMapper = new client.models['RedisAccessKeys']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -669,8 +1054,22 @@ Redis.prototype.listByResourceGroup = function (resourceGroupName, options, call }; /** - * Gets all redis caches in the specified subscription. + * Reboot specified redis node(s). This operation requires write permission to + * the cache resource. There can be potential data loss. * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} name The name of the redis cache. + * + * @param {object} parameters Specifies which redis node(s) to reboot. + * + * @param {string} parameters.rebootType Which redis node(s) to reboot. + * Depending on this value data loss is possible. Possible values include: + * 'PrimaryNode', 'SecondaryNode', 'AllNodes' + * + * @param {number} [parameters.shardId] In case of cluster cache, this + * specifies shard id which should be rebooted. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -682,14 +1081,13 @@ Redis.prototype.listByResourceGroup = function (resourceGroupName, options, call * * {Error} err - The Error object if an error occurred, null otherwise. * - * {object} [result] - The deserialized result object. - * See {@link RedisListResult} for more information. + * {null} [result] - The deserialized result object. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -Redis.prototype.list = function (options, callback) { +Redis.prototype.forceReboot = function (resourceGroupName, name, parameters, options, callback) { var client = this.client; if(!callback && typeof options === 'function') { callback = options; @@ -700,6 +1098,15 @@ Redis.prototype.list = function (options, callback) { } // Validate try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (name === null || name === undefined || typeof name.valueOf() !== 'string') { + throw new Error('name cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); } @@ -714,12 +1121,11 @@ Redis.prototype.list = function (options, callback) { } // Construct URL - var requestUrl = this.client.baseUri + - '//subscriptions/{subscriptionId}/providers/Microsoft.Cache/Redis/'; + var baseUrl = this.client.baseUri; + var requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/forceReboot'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - // trim all duplicate forward slashes in the url - var regex = /([^:]\/)\/+/gi; - requestUrl = requestUrl.replace(regex, '$1'); var queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { @@ -728,7 +1134,7 @@ Redis.prototype.list = function (options, callback) { // Create HTTP transport objects var httpRequest = new WebResource(); - httpRequest.method = 'GET'; + httpRequest.method = 'POST'; httpRequest.headers = {}; httpRequest.url = requestUrl; // Set Headers @@ -746,14 +1152,28 @@ Redis.prototype.list = function (options, callback) { } } httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; - httpRequest.body = null; + // Serialize Request + var requestContent = null; + var requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + var requestModelMapper = new client.models['RedisRebootParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + var serializationError = new Error(util.format('Error "%s" occurred in serializing the ' + + 'payload - "%s"', error.message, util.inspect(parameters, {depth: null}))); + return callback(serializationError); + } + httpRequest.body = requestContent; // Send Request return client.pipeline(httpRequest, function (err, response, responseBody) { if (err) { return callback(err); } var statusCode = response.statusCode; - if (statusCode !== 200) { + if (statusCode !== 200 && statusCode !== 204) { var error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -767,10 +1187,6 @@ Redis.prototype.list = function (options, callback) { if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; } - if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - var resultMapper = new client.models['CloudError']().mapper(); - error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); - } } catch (defaultError) { error.message = util.format('Error "%s" occurred in deserializing the responseBody ' + '- "%s" for the default response.', defaultError.message, responseBody); @@ -781,35 +1197,193 @@ Redis.prototype.list = function (options, callback) { // Create Result var result = null; if (responseBody === '') responseBody = null; - // Deserialize Response - if (statusCode === 200) { - var parsedResponse = null; - try { - parsedResponse = JSON.parse(responseBody); - result = JSON.parse(responseBody); - if (parsedResponse !== null && parsedResponse !== undefined) { - var resultMapper = new client.models['RedisListResult']().mapper(); - result = client.deserialize(resultMapper, parsedResponse, 'result'); - } - } catch (error) { - var deserializationError = new Error(util.format('Error "%s" occurred in deserializing the responseBody - "%s"', error, responseBody)); - deserializationError.request = msRest.stripRequest(httpRequest); - deserializationError.response = msRest.stripResponse(response); - return callback(deserializationError); - } - } return callback(null, result, httpRequest, response); }); }; /** - * Retrieve a redis cache's access keys. This operation requires write - * permission to the cache resource. + * + * Import data into redis cache. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} name The name of the redis cache. + * + * @param {object} parameters Parameters for redis import operation. + * + * @param {string} [parameters.format] File format. + * + * @param {array} parameters.files files to import + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} 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. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +Redis.prototype.importData = function (resourceGroupName, name, parameters, options, callback) { + var client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginImportData(resourceGroupName, name, parameters, options, function (err, parsedResult, httpRequest, response){ + if (err) return callback(err); + + var initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, function (err, pollingResult) { + if (err) return callback(err); + + // Create Result + var result = null; + httpRequest = pollingResult.request; + response = pollingResult.response; + var responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +}; + +/** + * + * Import data into redis cache. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} name The name of the redis cache. + * + * @param {object} parameters Parameters for redis export operation. + * + * @param {string} [parameters.format] File format. + * + * @param {string} parameters.prefix Prefix to use for exported files. + * + * @param {string} parameters.container Container name to export to. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} 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. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +Redis.prototype.exportData = function (resourceGroupName, name, parameters, options, callback) { + var client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginExportData(resourceGroupName, name, parameters, options, function (err, parsedResult, httpRequest, response){ + if (err) return callback(err); + + var initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, function (err, pollingResult) { + if (err) return callback(err); + + // Create Result + var result = null; + httpRequest = pollingResult.request; + response = pollingResult.response; + var responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +}; + +/** + * Create or replace (overwrite/recreate, with potential downtime) an existing + * redis cache * * @param {string} resourceGroupName The name of the resource group. * - * @param {string} name The name of the redis cache. + * @param {string} name The name of the redis cache. + * + * @param {object} parameters Parameters supplied to the Create redis + * operation. + * + * @param {object} [parameters.redisConfiguration] All Redis Settings. Few + * possible keys: + * rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value + * etc. + * + * @param {boolean} [parameters.enableNonSslPort] If the value is true, then + * the non-ssl redis server port (6379) will be enabled. + * + * @param {object} [parameters.tenantSettings] tenantSettings + * + * @param {number} [parameters.shardCount] The number of shards to be created + * on a Premium Cluster Cache. + * + * @param {string} [parameters.subnetId] The full resource ID of a subnet in a + * virtual network to deploy the redis cache in. Example format: + * /subscriptions/{subid}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1 + * + * @param {string} [parameters.staticIP] Required when deploying a redis cache + * inside an existing Azure Virtual Network. + * + * @param {object} parameters.sku What sku of redis cache to deploy. + * + * @param {string} parameters.sku.name What type of redis cache to deploy. + * Valid values: (Basic, Standard, Premium). Possible values include: + * 'Basic', 'Standard', 'Premium' + * + * @param {string} parameters.sku.family Which family to use. Valid values: + * (C, P). Possible values include: 'C', 'P' + * + * @param {number} parameters.sku.capacity What size of redis cache to deploy. + * Valid values: for C family (0, 1, 2, 3, 4, 5, 6), for P family (1, 2, 3, 4) + * + * @param {string} parameters.location Resource location + * + * @param {object} [parameters.tags] Resource tags * * @param {object} [options] Optional Parameters. * @@ -823,13 +1397,13 @@ Redis.prototype.list = function (options, callback) { * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object. - * See {@link RedisListKeysResult} for more information. + * See {@link RedisResource} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -Redis.prototype.listKeys = function (resourceGroupName, name, options, callback) { +Redis.prototype.beginCreate = function (resourceGroupName, name, parameters, options, callback) { var client = this.client; if(!callback && typeof options === 'function') { callback = options; @@ -846,6 +1420,9 @@ Redis.prototype.listKeys = function (resourceGroupName, name, options, callback) if (name === null || name === undefined || typeof name.valueOf() !== 'string') { throw new Error('name cannot be null or undefined and it must be of type string.'); } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); } @@ -860,14 +1437,11 @@ Redis.prototype.listKeys = function (resourceGroupName, name, options, callback) } // Construct URL - var requestUrl = this.client.baseUri + - '//subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/listKeys'; + var baseUrl = this.client.baseUri; + var requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - // trim all duplicate forward slashes in the url - var regex = /([^:]\/)\/+/gi; - requestUrl = requestUrl.replace(regex, '$1'); var queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { @@ -876,7 +1450,7 @@ Redis.prototype.listKeys = function (resourceGroupName, name, options, callback) // Create HTTP transport objects var httpRequest = new WebResource(); - httpRequest.method = 'POST'; + httpRequest.method = 'PUT'; httpRequest.headers = {}; httpRequest.url = requestUrl; // Set Headers @@ -894,14 +1468,28 @@ Redis.prototype.listKeys = function (resourceGroupName, name, options, callback) } } httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; - httpRequest.body = null; + // Serialize Request + var requestContent = null; + var requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + var requestModelMapper = new client.models['RedisCreateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + var serializationError = new Error(util.format('Error "%s" occurred in serializing the ' + + 'payload - "%s"', error.message, util.inspect(parameters, {depth: null}))); + return callback(serializationError); + } + httpRequest.body = requestContent; // Send Request return client.pipeline(httpRequest, function (err, response, responseBody) { if (err) { return callback(err); } var statusCode = response.statusCode; - if (statusCode !== 200) { + if (statusCode !== 201 && statusCode !== 200) { var error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -936,7 +1524,7 @@ Redis.prototype.listKeys = function (resourceGroupName, name, options, callback) parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - var resultMapper = new client.models['RedisListKeysResult']().mapper(); + var resultMapper = new client.models['RedisResource']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -952,15 +1540,48 @@ Redis.prototype.listKeys = function (resourceGroupName, name, options, callback) }; /** - * Regenerate redis cache's access keys. This operation requires write - * permission to the cache resource. + * Update an existing Redis cache * * @param {string} resourceGroupName The name of the resource group. * * @param {string} name The name of the redis cache. * - * @param {string} keyType Which redis access key to reset. Possible values - * include: 'Primary', 'Secondary' + * @param {object} parameters Parameters supplied to the Update redis + * operation. + * + * @param {object} [parameters.redisConfiguration] All Redis Settings. Few + * possible keys: + * rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value + * etc. + * + * @param {boolean} [parameters.enableNonSslPort] If the value is true, then + * the non-ssl redis server port (6379) will be enabled. + * + * @param {object} [parameters.tenantSettings] tenantSettings + * + * @param {number} [parameters.shardCount] The number of shards to be created + * on a Premium Cluster Cache. + * + * @param {string} [parameters.subnetId] The full resource ID of a subnet in a + * virtual network to deploy the redis cache in. Example format: + * /subscriptions/{subid}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1 + * + * @param {string} [parameters.staticIP] Required when deploying a redis cache + * inside an existing Azure Virtual Network. + * + * @param {object} [parameters.sku] What sku of redis cache to deploy. + * + * @param {string} parameters.sku.name What type of redis cache to deploy. + * Valid values: (Basic, Standard, Premium). Possible values include: + * 'Basic', 'Standard', 'Premium' + * + * @param {string} parameters.sku.family Which family to use. Valid values: + * (C, P). Possible values include: 'C', 'P' + * + * @param {number} parameters.sku.capacity What size of redis cache to deploy. + * Valid values: for C family (0, 1, 2, 3, 4, 5, 6), for P family (1, 2, 3, 4) + * + * @param {object} [parameters.tags] Resource tags * * @param {object} [options] Optional Parameters. * @@ -974,13 +1595,13 @@ Redis.prototype.listKeys = function (resourceGroupName, name, options, callback) * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object. - * See {@link RedisListKeysResult} for more information. + * See {@link RedisResource} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -Redis.prototype.regenerateKey = function (resourceGroupName, name, keyType, options, callback) { +Redis.prototype.beginUpdate = function (resourceGroupName, name, parameters, options, callback) { var client = this.client; if(!callback && typeof options === 'function') { callback = options; @@ -997,41 +1618,28 @@ Redis.prototype.regenerateKey = function (resourceGroupName, name, keyType, opti if (name === null || name === undefined || typeof name.valueOf() !== 'string') { throw new Error('name cannot be null or undefined and it must be of type string.'); } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } - if (keyType) { - var allowedValues = [ 'Primary', 'Secondary' ]; - if (!allowedValues.some( function(item) { return item === keyType; })) { - throw new Error(keyType + ' is not a valid value. The valid values are: ' + allowedValues); - } - } else { - throw new Error('keyType 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); } - var parameters; - if (keyType !== null && keyType !== undefined) { - parameters = new client.models['RedisRegenerateKeyParameters'](); - parameters.keyType = keyType; - } // Construct URL - var requestUrl = this.client.baseUri + - '//subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/regenerateKey'; + var baseUrl = this.client.baseUri; + var requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - // trim all duplicate forward slashes in the url - var regex = /([^:]\/)\/+/gi; - requestUrl = requestUrl.replace(regex, '$1'); var queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { @@ -1040,7 +1648,7 @@ Redis.prototype.regenerateKey = function (resourceGroupName, name, keyType, opti // Create HTTP transport objects var httpRequest = new WebResource(); - httpRequest.method = 'POST'; + httpRequest.method = 'PATCH'; httpRequest.headers = {}; httpRequest.url = requestUrl; // Set Headers @@ -1063,7 +1671,7 @@ Redis.prototype.regenerateKey = function (resourceGroupName, name, keyType, opti var requestModel = null; try { if (parameters !== null && parameters !== undefined) { - var requestModelMapper = new client.models['RedisRegenerateKeyParameters']().mapper(); + var requestModelMapper = new client.models['RedisUpdateParameters']().mapper(); requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); requestContent = JSON.stringify(requestModel); } @@ -1114,7 +1722,7 @@ Redis.prototype.regenerateKey = function (resourceGroupName, name, keyType, opti parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - var resultMapper = new client.models['RedisListKeysResult']().mapper(); + var resultMapper = new client.models['RedisResource']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -1130,22 +1738,12 @@ Redis.prototype.regenerateKey = function (resourceGroupName, name, keyType, opti }; /** - * Reboot specified redis node(s). This operation requires write permission to - * the cache resource. There can be potential data loss. + * Deletes a redis cache. This operation takes a while to complete. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} name The name of the redis cache. * - * @param {object} parameters Specifies which redis node(s) to reboot. - * - * @param {string} parameters.rebootType Which redis node(s) to reboot. - * Depending on this value data loss is possible. Possible values include: - * 'PrimaryNode', 'SecondaryNode', 'AllNodes' - * - * @param {number} [parameters.shardId] In case of cluster cache, this - * specifies shard id which should be rebooted. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1163,7 +1761,7 @@ Redis.prototype.regenerateKey = function (resourceGroupName, name, keyType, opti * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -Redis.prototype.forceReboot = function (resourceGroupName, name, parameters, options, callback) { +Redis.prototype.beginDeleteMethod = function (resourceGroupName, name, options, callback) { var client = this.client; if(!callback && typeof options === 'function') { callback = options; @@ -1180,9 +1778,6 @@ Redis.prototype.forceReboot = function (resourceGroupName, name, parameters, opt if (name === null || name === undefined || typeof name.valueOf() !== 'string') { throw new Error('name cannot be null or undefined and it must be of type string.'); } - if (parameters === null || parameters === undefined) { - throw new Error('parameters cannot be null or undefined.'); - } if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); } @@ -1197,14 +1792,11 @@ Redis.prototype.forceReboot = function (resourceGroupName, name, parameters, opt } // Construct URL - var requestUrl = this.client.baseUri + - '//subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/forceReboot'; + var baseUrl = this.client.baseUri; + var requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - // trim all duplicate forward slashes in the url - var regex = /([^:]\/)\/+/gi; - requestUrl = requestUrl.replace(regex, '$1'); var queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { @@ -1213,7 +1805,7 @@ Redis.prototype.forceReboot = function (resourceGroupName, name, parameters, opt // Create HTTP transport objects var httpRequest = new WebResource(); - httpRequest.method = 'POST'; + httpRequest.method = 'DELETE'; httpRequest.headers = {}; httpRequest.url = requestUrl; // Set Headers @@ -1231,21 +1823,7 @@ Redis.prototype.forceReboot = function (resourceGroupName, name, parameters, opt } } httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; - // Serialize Request - var requestContent = null; - var requestModel = null; - try { - if (parameters !== null && parameters !== undefined) { - var requestModelMapper = new client.models['RedisRebootParameters']().mapper(); - requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - var serializationError = new Error(util.format('Error "%s" occurred in serializing the ' + - 'payload - "%s"', error.message, util.inspect(parameters, {depth: null}))); - return callback(serializationError); - } - httpRequest.body = requestContent; + httpRequest.body = null; // Send Request return client.pipeline(httpRequest, function (err, response, responseBody) { if (err) { @@ -1281,73 +1859,6 @@ Redis.prototype.forceReboot = function (resourceGroupName, name, parameters, opt }); }; -/** - * - * Import data into redis cache. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} name The name of the redis cache. - * - * @param {object} parameters Parameters for redis import operation. - * - * @param {string} [parameters.format] File format. - * - * @param {array} parameters.files files to import - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @param {function} 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. - * - * {object} [request] - The HTTP Request object if an error did not occur. - * - * {stream} [response] - The HTTP Response stream if an error did not occur. - */ -Redis.prototype.importMethod = function (resourceGroupName, name, parameters, options, callback) { - var client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - - if (!callback) { - throw new Error('callback cannot be null.'); - } - - // Send request - this.beginImportMethod(resourceGroupName, name, parameters, options, function (err, parsedResult, httpRequest, response){ - if (err) return callback(err); - - var initialResult = new msRest.HttpOperationResponse(); - initialResult.request = httpRequest; - initialResult.response = response; - initialResult.body = response.body; - client.getLongRunningOperationResult(initialResult, options, function (err, pollingResult) { - if (err) return callback(err); - - // Create Result - var result = null; - httpRequest = pollingResult.request; - response = pollingResult.response; - var responseBody = pollingResult.body; - if (responseBody === '') responseBody = null; - - // Deserialize Response - - return callback(null, result, httpRequest, response); - }); - }); -}; - /** * Import data into redis cache. * @@ -1378,7 +1889,7 @@ Redis.prototype.importMethod = function (resourceGroupName, name, parameters, op * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -Redis.prototype.beginImportMethod = function (resourceGroupName, name, parameters, options, callback) { +Redis.prototype.beginImportData = function (resourceGroupName, name, parameters, options, callback) { var client = this.client; if(!callback && typeof options === 'function') { callback = options; @@ -1412,14 +1923,11 @@ Redis.prototype.beginImportMethod = function (resourceGroupName, name, parameter } // Construct URL - var requestUrl = this.client.baseUri + - '//subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/import'; + var baseUrl = this.client.baseUri; + var requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/import'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - // trim all duplicate forward slashes in the url - var regex = /([^:]\/)\/+/gi; - requestUrl = requestUrl.replace(regex, '$1'); var queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { @@ -1496,75 +2004,6 @@ Redis.prototype.beginImportMethod = function (resourceGroupName, name, parameter }); }; -/** - * - * Import data into redis cache. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} name The name of the redis cache. - * - * @param {object} parameters Parameters for redis export operation. - * - * @param {string} [parameters.format] File format. - * - * @param {string} parameters.prefix Prifix to use for exported files. - * - * @param {string} parameters.container Container name to export to. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @param {function} 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. - * - * {object} [request] - The HTTP Request object if an error did not occur. - * - * {stream} [response] - The HTTP Response stream if an error did not occur. - */ -Redis.prototype.exportMethod = function (resourceGroupName, name, parameters, options, callback) { - var client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - - if (!callback) { - throw new Error('callback cannot be null.'); - } - - // Send request - this.beginExportMethod(resourceGroupName, name, parameters, options, function (err, parsedResult, httpRequest, response){ - if (err) return callback(err); - - var initialResult = new msRest.HttpOperationResponse(); - initialResult.request = httpRequest; - initialResult.response = response; - initialResult.body = response.body; - client.getLongRunningOperationResult(initialResult, options, function (err, pollingResult) { - if (err) return callback(err); - - // Create Result - var result = null; - httpRequest = pollingResult.request; - response = pollingResult.response; - var responseBody = pollingResult.body; - if (responseBody === '') responseBody = null; - - // Deserialize Response - - return callback(null, result, httpRequest, response); - }); - }); -}; - /** * Import data into redis cache. * @@ -1576,7 +2015,7 @@ Redis.prototype.exportMethod = function (resourceGroupName, name, parameters, op * * @param {string} [parameters.format] File format. * - * @param {string} parameters.prefix Prifix to use for exported files. + * @param {string} parameters.prefix Prefix to use for exported files. * * @param {string} parameters.container Container name to export to. * @@ -1597,7 +2036,7 @@ Redis.prototype.exportMethod = function (resourceGroupName, name, parameters, op * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -Redis.prototype.beginExportMethod = function (resourceGroupName, name, parameters, options, callback) { +Redis.prototype.beginExportData = function (resourceGroupName, name, parameters, options, callback) { var client = this.client; if(!callback && typeof options === 'function') { callback = options; @@ -1631,14 +2070,11 @@ Redis.prototype.beginExportMethod = function (resourceGroupName, name, parameter } // Construct URL - var requestUrl = this.client.baseUri + - '//subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/export'; + var baseUrl = this.client.baseUri; + var requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/export'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{name}', encodeURIComponent(name)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - // trim all duplicate forward slashes in the url - var regex = /([^:]\/)\/+/gi; - requestUrl = requestUrl.replace(regex, '$1'); var queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { @@ -1763,9 +2199,6 @@ Redis.prototype.listByResourceGroupNext = function (nextPageLink, options, callb // Construct URL var requestUrl = '{nextLink}'; requestUrl = requestUrl.replace('{nextLink}', nextPageLink); - // trim all duplicate forward slashes in the url - var regex = /([^:]\/)\/+/gi; - requestUrl = requestUrl.replace(regex, '$1'); // Create HTTP transport objects var httpRequest = new WebResource(); @@ -1892,9 +2325,6 @@ Redis.prototype.listNext = function (nextPageLink, options, callback) { // Construct URL var requestUrl = '{nextLink}'; requestUrl = requestUrl.replace('{nextLink}', nextPageLink); - // trim all duplicate forward slashes in the url - var regex = /([^:]\/)\/+/gi; - requestUrl = requestUrl.replace(regex, '$1'); // Create HTTP transport objects var httpRequest = new WebResource();