diff --git a/lib/services/storageManagement2/lib/models/dateAfterCreation.js b/lib/services/storageManagement2/lib/models/dateAfterCreation.js new file mode 100644 index 0000000000..f33e36b987 --- /dev/null +++ b/lib/services/storageManagement2/lib/models/dateAfterCreation.js @@ -0,0 +1,56 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Object to define the number of days after creation. + * + */ +class DateAfterCreation { + /** + * Create a DateAfterCreation. + * @property {number} daysAfterCreationGreaterThan Integer value indicating + * the age in days after creation + */ + constructor() { + } + + /** + * Defines the metadata of DateAfterCreation + * + * @returns {object} metadata of DateAfterCreation + * + */ + mapper() { + return { + required: false, + serializedName: 'DateAfterCreation', + type: { + name: 'Composite', + className: 'DateAfterCreation', + modelProperties: { + daysAfterCreationGreaterThan: { + required: true, + serializedName: 'daysAfterCreationGreaterThan', + constraints: { + InclusiveMinimum: 0 + }, + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = DateAfterCreation; diff --git a/lib/services/storageManagement2/lib/models/dateAfterModification.js b/lib/services/storageManagement2/lib/models/dateAfterModification.js new file mode 100644 index 0000000000..27c5d0df71 --- /dev/null +++ b/lib/services/storageManagement2/lib/models/dateAfterModification.js @@ -0,0 +1,56 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Object to define the number of days after last modification. + * + */ +class DateAfterModification { + /** + * Create a DateAfterModification. + * @property {number} daysAfterModificationGreaterThan Integer value + * indicating the age in days after last modification + */ + constructor() { + } + + /** + * Defines the metadata of DateAfterModification + * + * @returns {object} metadata of DateAfterModification + * + */ + mapper() { + return { + required: false, + serializedName: 'DateAfterModification', + type: { + name: 'Composite', + className: 'DateAfterModification', + modelProperties: { + daysAfterModificationGreaterThan: { + required: true, + serializedName: 'daysAfterModificationGreaterThan', + constraints: { + InclusiveMinimum: 0 + }, + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = DateAfterModification; diff --git a/lib/services/storageManagement2/lib/models/index.d.ts b/lib/services/storageManagement2/lib/models/index.d.ts index e2d1514552..2c7114fdd3 100644 --- a/lib/services/storageManagement2/lib/models/index.d.ts +++ b/lib/services/storageManagement2/lib/models/index.d.ts @@ -932,6 +932,144 @@ export interface ListServiceSasResponse { readonly serviceSasToken?: string; } +/** + * Object to define the number of days after last modification. +*/ +export interface DateAfterModification { + /** + * Integer value indicating the age in days after last modification + */ + daysAfterModificationGreaterThan: number; +} + +/** + * Management policy action for base blob. +*/ +export interface ManagementPolicyBaseBlob { + /** + * The function to tier blobs to cool storage. Support blobs currently at Hot tier + */ + tierToCool?: DateAfterModification; + /** + * The function to tier blobs to archive storage. Support blobs currently at Hot or Cool tier + */ + tierToArchive?: DateAfterModification; + /** + * The function to delete the blob + */ + deleteProperty?: DateAfterModification; +} + +/** + * Object to define the number of days after creation. +*/ +export interface DateAfterCreation { + /** + * Integer value indicating the age in days after creation + */ + daysAfterCreationGreaterThan: number; +} + +/** + * Management policy action for snapshot. +*/ +export interface ManagementPolicySnapShot { + /** + * The function to delete the blob snapshot + */ + deleteProperty?: DateAfterCreation; +} + +/** + * Actions are applied to the filtered blobs when the execution condition is met. +*/ +export interface ManagementPolicyAction { + /** + * The management policy action for base blob + */ + baseBlob?: ManagementPolicyBaseBlob; + /** + * The management policy action for snapshot + */ + snapshot?: ManagementPolicySnapShot; +} + +/** + * Filters limit rule actions to a subset of blobs within the storage account. If multiple filters + * are defined, a logical AND is performed on all filters. +*/ +export interface ManagementPolicyFilter { + /** + * An array of strings for prefixes to be match. + */ + prefixMatch?: string[]; + /** + * An array of predefined enum values. Only blockBlob is supported. + */ + blobTypes: string[]; +} + +/** + * An object that defines the Lifecycle rule. Each definition is made up with a filters set and an + * actions set. +*/ +export interface ManagementPolicyDefinition { + /** + * An object that defines the action set. + */ + actions: ManagementPolicyAction; + /** + * An object that defines the filter set. + */ + filters?: ManagementPolicyFilter; +} + +/** + * An object that wraps the Lifecycle rule. Each rule is uniquely defined by name. +*/ +export interface ManagementPolicyRule { + /** + * Rule is enabled if set to true. + */ + enabled?: boolean; + /** + * A rule name can contain any combination of alpha numeric characters. Rule name is + * case-sensitive. It must be unique within a policy. + */ + name: string; + /** + * An object that defines the Lifecycle rule. + */ + definition: ManagementPolicyDefinition; +} + +/** + * The Storage Account ManagementPolicies Rules. See more details in: + * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. +*/ +export interface ManagementPolicySchema { + /** + * The Storage Account ManagementPolicies Rules. See more details in: + * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + */ + rules: ManagementPolicyRule[]; +} + +/** + * The Get Storage Account ManagementPolicies operation response. +*/ +export interface ManagementPolicy extends Resource { + /** + * Returns the date and time the ManagementPolicies was last modified. + */ + readonly lastModifiedTime?: Date; + /** + * The Storage Account ManagementPolicy, in JSON format. See more details in: + * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + */ + policy: ManagementPolicySchema; +} + /** * The resource model definition for a ARM proxy resource. It will have everything other than * required location and tags @@ -1274,33 +1412,6 @@ export interface BlobServiceProperties extends Resource { deleteRetentionPolicy?: DeleteRetentionPolicy; } -/** - * The Get Storage Account ManagementPolicies operation response. -*/ -export interface StorageAccountManagementPolicies extends Resource { - /** - * The Storage Account ManagementPolicies Rules, in JSON format. See more details in: - * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - */ - policy?: any; - /** - * Returns the date and time the ManagementPolicies was last modified. - */ - readonly lastModifiedTime?: Date; -} - -/** - * The Storage Account ManagementPolicies Rules, in JSON format. See more details in: - * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. -*/ -export interface ManagementPoliciesRulesSetParameter { - /** - * The Storage Account ManagementPolicies Rules, in JSON format. See more details in: - * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - */ - policy?: any; -} - /** * Result of the request to list Storage operations. It contains a list of operations and a URL * link to get the next set of results. diff --git a/lib/services/storageManagement2/lib/models/index.js b/lib/services/storageManagement2/lib/models/index.js index 4856015999..a9add56e1f 100644 --- a/lib/services/storageManagement2/lib/models/index.js +++ b/lib/services/storageManagement2/lib/models/index.js @@ -53,6 +53,16 @@ exports.AccountSasParameters = require('./accountSasParameters'); exports.ListAccountSasResponse = require('./listAccountSasResponse'); exports.ServiceSasParameters = require('./serviceSasParameters'); exports.ListServiceSasResponse = require('./listServiceSasResponse'); +exports.DateAfterModification = require('./dateAfterModification'); +exports.ManagementPolicyBaseBlob = require('./managementPolicyBaseBlob'); +exports.DateAfterCreation = require('./dateAfterCreation'); +exports.ManagementPolicySnapShot = require('./managementPolicySnapShot'); +exports.ManagementPolicyAction = require('./managementPolicyAction'); +exports.ManagementPolicyFilter = require('./managementPolicyFilter'); +exports.ManagementPolicyDefinition = require('./managementPolicyDefinition'); +exports.ManagementPolicyRule = require('./managementPolicyRule'); +exports.ManagementPolicySchema = require('./managementPolicySchema'); +exports.ManagementPolicy = require('./managementPolicy'); exports.ProxyResource = require('./proxyResource'); exports.AzureEntityResource = require('./azureEntityResource'); exports.UpdateHistoryProperty = require('./updateHistoryProperty'); @@ -68,8 +78,6 @@ exports.CorsRule = require('./corsRule'); exports.CorsRules = require('./corsRules'); exports.DeleteRetentionPolicy = require('./deleteRetentionPolicy'); exports.BlobServiceProperties = require('./blobServiceProperties'); -exports.StorageAccountManagementPolicies = require('./storageAccountManagementPolicies'); -exports.ManagementPoliciesRulesSetParameter = require('./managementPoliciesRulesSetParameter'); exports.OperationListResult = require('./operationListResult'); exports.StorageSkuListResult = require('./storageSkuListResult'); exports.StorageAccountListResult = require('./storageAccountListResult'); diff --git a/lib/services/storageManagement2/lib/models/managementPolicy.js b/lib/services/storageManagement2/lib/models/managementPolicy.js new file mode 100644 index 0000000000..145fdf2e94 --- /dev/null +++ b/lib/services/storageManagement2/lib/models/managementPolicy.js @@ -0,0 +1,96 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The Get Storage Account ManagementPolicies operation response. + * + * @extends models['Resource'] + */ +class ManagementPolicy extends models['Resource'] { + /** + * Create a ManagementPolicy. + * @property {date} [lastModifiedTime] Returns the date and time the + * ManagementPolicies was last modified. + * @property {object} policy The Storage Account ManagementPolicy, in JSON + * format. See more details in: + * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + * @property {array} [policy.rules] The Storage Account ManagementPolicies + * Rules. See more details in: + * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ManagementPolicy + * + * @returns {object} metadata of ManagementPolicy + * + */ + mapper() { + return { + required: false, + serializedName: 'ManagementPolicy', + type: { + name: 'Composite', + className: 'ManagementPolicy', + 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' + } + }, + lastModifiedTime: { + required: false, + readOnly: true, + serializedName: 'properties.lastModifiedTime', + type: { + name: 'DateTime' + } + }, + policy: { + required: true, + serializedName: 'properties.policy', + type: { + name: 'Composite', + className: 'ManagementPolicySchema' + } + } + } + } + }; + } +} + +module.exports = ManagementPolicy; diff --git a/lib/services/storageManagement2/lib/models/managementPolicyAction.js b/lib/services/storageManagement2/lib/models/managementPolicyAction.js new file mode 100644 index 0000000000..9ebaec8e2b --- /dev/null +++ b/lib/services/storageManagement2/lib/models/managementPolicyAction.js @@ -0,0 +1,81 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Actions are applied to the filtered blobs when the execution condition is + * met. + * + */ +class ManagementPolicyAction { + /** + * Create a ManagementPolicyAction. + * @property {object} [baseBlob] The management policy action for base blob + * @property {object} [baseBlob.tierToCool] The function to tier blobs to + * cool storage. Support blobs currently at Hot tier + * @property {number} [baseBlob.tierToCool.daysAfterModificationGreaterThan] + * Integer value indicating the age in days after last modification + * @property {object} [baseBlob.tierToArchive] The function to tier blobs to + * archive storage. Support blobs currently at Hot or Cool tier + * @property {number} + * [baseBlob.tierToArchive.daysAfterModificationGreaterThan] Integer value + * indicating the age in days after last modification + * @property {object} [baseBlob.deleteProperty] The function to delete the + * blob + * @property {number} + * [baseBlob.deleteProperty.daysAfterModificationGreaterThan] Integer value + * indicating the age in days after last modification + * @property {object} [snapshot] The management policy action for snapshot + * @property {object} [snapshot.deleteProperty] The function to delete the + * blob snapshot + * @property {number} [snapshot.deleteProperty.daysAfterCreationGreaterThan] + * Integer value indicating the age in days after creation + */ + constructor() { + } + + /** + * Defines the metadata of ManagementPolicyAction + * + * @returns {object} metadata of ManagementPolicyAction + * + */ + mapper() { + return { + required: false, + serializedName: 'ManagementPolicyAction', + type: { + name: 'Composite', + className: 'ManagementPolicyAction', + modelProperties: { + baseBlob: { + required: false, + serializedName: 'baseBlob', + type: { + name: 'Composite', + className: 'ManagementPolicyBaseBlob' + } + }, + snapshot: { + required: false, + serializedName: 'snapshot', + type: { + name: 'Composite', + className: 'ManagementPolicySnapShot' + } + } + } + } + }; + } +} + +module.exports = ManagementPolicyAction; diff --git a/lib/services/storageManagement2/lib/models/managementPolicyBaseBlob.js b/lib/services/storageManagement2/lib/models/managementPolicyBaseBlob.js new file mode 100644 index 0000000000..fac84aa2c1 --- /dev/null +++ b/lib/services/storageManagement2/lib/models/managementPolicyBaseBlob.js @@ -0,0 +1,79 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Management policy action for base blob. + * + */ +class ManagementPolicyBaseBlob { + /** + * Create a ManagementPolicyBaseBlob. + * @property {object} [tierToCool] The function to tier blobs to cool + * storage. Support blobs currently at Hot tier + * @property {number} [tierToCool.daysAfterModificationGreaterThan] Integer + * value indicating the age in days after last modification + * @property {object} [tierToArchive] The function to tier blobs to archive + * storage. Support blobs currently at Hot or Cool tier + * @property {number} [tierToArchive.daysAfterModificationGreaterThan] + * Integer value indicating the age in days after last modification + * @property {object} [deleteProperty] The function to delete the blob + * @property {number} [deleteProperty.daysAfterModificationGreaterThan] + * Integer value indicating the age in days after last modification + */ + constructor() { + } + + /** + * Defines the metadata of ManagementPolicyBaseBlob + * + * @returns {object} metadata of ManagementPolicyBaseBlob + * + */ + mapper() { + return { + required: false, + serializedName: 'ManagementPolicyBaseBlob', + type: { + name: 'Composite', + className: 'ManagementPolicyBaseBlob', + modelProperties: { + tierToCool: { + required: false, + serializedName: 'tierToCool', + type: { + name: 'Composite', + className: 'DateAfterModification' + } + }, + tierToArchive: { + required: false, + serializedName: 'tierToArchive', + type: { + name: 'Composite', + className: 'DateAfterModification' + } + }, + deleteProperty: { + required: false, + serializedName: 'delete', + type: { + name: 'Composite', + className: 'DateAfterModification' + } + } + } + } + }; + } +} + +module.exports = ManagementPolicyBaseBlob; diff --git a/lib/services/storageManagement2/lib/models/managementPolicyDefinition.js b/lib/services/storageManagement2/lib/models/managementPolicyDefinition.js new file mode 100644 index 0000000000..1fa9e6c930 --- /dev/null +++ b/lib/services/storageManagement2/lib/models/managementPolicyDefinition.js @@ -0,0 +1,91 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * An object that defines the Lifecycle rule. Each definition is made up with a + * filters set and an actions set. + * + */ +class ManagementPolicyDefinition { + /** + * Create a ManagementPolicyDefinition. + * @property {object} actions An object that defines the action set. + * @property {object} [actions.baseBlob] The management policy action for + * base blob + * @property {object} [actions.baseBlob.tierToCool] The function to tier + * blobs to cool storage. Support blobs currently at Hot tier + * @property {number} + * [actions.baseBlob.tierToCool.daysAfterModificationGreaterThan] Integer + * value indicating the age in days after last modification + * @property {object} [actions.baseBlob.tierToArchive] The function to tier + * blobs to archive storage. Support blobs currently at Hot or Cool tier + * @property {number} + * [actions.baseBlob.tierToArchive.daysAfterModificationGreaterThan] Integer + * value indicating the age in days after last modification + * @property {object} [actions.baseBlob.deleteProperty] The function to + * delete the blob + * @property {number} + * [actions.baseBlob.deleteProperty.daysAfterModificationGreaterThan] Integer + * value indicating the age in days after last modification + * @property {object} [actions.snapshot] The management policy action for + * snapshot + * @property {object} [actions.snapshot.deleteProperty] The function to + * delete the blob snapshot + * @property {number} + * [actions.snapshot.deleteProperty.daysAfterCreationGreaterThan] Integer + * value indicating the age in days after creation + * @property {object} [filters] An object that defines the filter set. + * @property {array} [filters.prefixMatch] An array of strings for prefixes + * to be match. + * @property {array} [filters.blobTypes] An array of predefined enum values. + * Only blockBlob is supported. + */ + constructor() { + } + + /** + * Defines the metadata of ManagementPolicyDefinition + * + * @returns {object} metadata of ManagementPolicyDefinition + * + */ + mapper() { + return { + required: false, + serializedName: 'ManagementPolicyDefinition', + type: { + name: 'Composite', + className: 'ManagementPolicyDefinition', + modelProperties: { + actions: { + required: true, + serializedName: 'actions', + type: { + name: 'Composite', + className: 'ManagementPolicyAction' + } + }, + filters: { + required: false, + serializedName: 'filters', + type: { + name: 'Composite', + className: 'ManagementPolicyFilter' + } + } + } + } + }; + } +} + +module.exports = ManagementPolicyDefinition; diff --git a/lib/services/storageManagement2/lib/models/managementPolicyFilter.js b/lib/services/storageManagement2/lib/models/managementPolicyFilter.js new file mode 100644 index 0000000000..ba84cc5434 --- /dev/null +++ b/lib/services/storageManagement2/lib/models/managementPolicyFilter.js @@ -0,0 +1,77 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Filters limit rule actions to a subset of blobs within the storage account. + * If multiple filters are defined, a logical AND is performed on all filters. + * + */ +class ManagementPolicyFilter { + /** + * Create a ManagementPolicyFilter. + * @property {array} [prefixMatch] An array of strings for prefixes to be + * match. + * @property {array} blobTypes An array of predefined enum values. Only + * blockBlob is supported. + */ + constructor() { + } + + /** + * Defines the metadata of ManagementPolicyFilter + * + * @returns {object} metadata of ManagementPolicyFilter + * + */ + mapper() { + return { + required: false, + serializedName: 'ManagementPolicyFilter', + type: { + name: 'Composite', + className: 'ManagementPolicyFilter', + modelProperties: { + prefixMatch: { + required: false, + serializedName: 'prefixMatch', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + blobTypes: { + required: true, + serializedName: 'blobTypes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = ManagementPolicyFilter; diff --git a/lib/services/storageManagement2/lib/models/managementPolicyRule.js b/lib/services/storageManagement2/lib/models/managementPolicyRule.js new file mode 100644 index 0000000000..ccb4e14aac --- /dev/null +++ b/lib/services/storageManagement2/lib/models/managementPolicyRule.js @@ -0,0 +1,114 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * An object that wraps the Lifecycle rule. Each rule is uniquely defined by + * name. + * + */ +class ManagementPolicyRule { + /** + * Create a ManagementPolicyRule. + * @property {boolean} [enabled] Rule is enabled if set to true. + * @property {string} name A rule name can contain any combination of alpha + * numeric characters. Rule name is case-sensitive. It must be unique within + * a policy. + * @property {object} definition An object that defines the Lifecycle rule. + * @property {object} [definition.actions] An object that defines the action + * set. + * @property {object} [definition.actions.baseBlob] The management policy + * action for base blob + * @property {object} [definition.actions.baseBlob.tierToCool] The function + * to tier blobs to cool storage. Support blobs currently at Hot tier + * @property {number} + * [definition.actions.baseBlob.tierToCool.daysAfterModificationGreaterThan] + * Integer value indicating the age in days after last modification + * @property {object} [definition.actions.baseBlob.tierToArchive] The + * function to tier blobs to archive storage. Support blobs currently at Hot + * or Cool tier + * @property {number} + * [definition.actions.baseBlob.tierToArchive.daysAfterModificationGreaterThan] + * Integer value indicating the age in days after last modification + * @property {object} [definition.actions.baseBlob.deleteProperty] The + * function to delete the blob + * @property {number} + * [definition.actions.baseBlob.deleteProperty.daysAfterModificationGreaterThan] + * Integer value indicating the age in days after last modification + * @property {object} [definition.actions.snapshot] The management policy + * action for snapshot + * @property {object} [definition.actions.snapshot.deleteProperty] The + * function to delete the blob snapshot + * @property {number} + * [definition.actions.snapshot.deleteProperty.daysAfterCreationGreaterThan] + * Integer value indicating the age in days after creation + * @property {object} [definition.filters] An object that defines the filter + * set. + * @property {array} [definition.filters.prefixMatch] An array of strings for + * prefixes to be match. + * @property {array} [definition.filters.blobTypes] An array of predefined + * enum values. Only blockBlob is supported. + */ + constructor() { + } + + /** + * Defines the metadata of ManagementPolicyRule + * + * @returns {object} metadata of ManagementPolicyRule + * + */ + mapper() { + return { + required: false, + serializedName: 'ManagementPolicyRule', + type: { + name: 'Composite', + className: 'ManagementPolicyRule', + modelProperties: { + enabled: { + required: false, + serializedName: 'enabled', + type: { + name: 'Boolean' + } + }, + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: true, + isConstant: true, + serializedName: 'type', + defaultValue: 'Lifecycle', + type: { + name: 'String' + } + }, + definition: { + required: true, + serializedName: 'definition', + type: { + name: 'Composite', + className: 'ManagementPolicyDefinition' + } + } + } + } + }; + } +} + +module.exports = ManagementPolicyRule; diff --git a/lib/services/storageManagement2/lib/models/managementPolicySchema.js b/lib/services/storageManagement2/lib/models/managementPolicySchema.js new file mode 100644 index 0000000000..1455b22b0f --- /dev/null +++ b/lib/services/storageManagement2/lib/models/managementPolicySchema.js @@ -0,0 +1,63 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The Storage Account ManagementPolicies Rules. See more details in: + * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + * + */ +class ManagementPolicySchema { + /** + * Create a ManagementPolicySchema. + * @property {array} rules The Storage Account ManagementPolicies Rules. See + * more details in: + * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + */ + constructor() { + } + + /** + * Defines the metadata of ManagementPolicySchema + * + * @returns {object} metadata of ManagementPolicySchema + * + */ + mapper() { + return { + required: false, + serializedName: 'ManagementPolicySchema', + type: { + name: 'Composite', + className: 'ManagementPolicySchema', + modelProperties: { + rules: { + required: true, + serializedName: 'rules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ManagementPolicyRuleElementType', + type: { + name: 'Composite', + className: 'ManagementPolicyRule' + } + } + } + } + } + } + }; + } +} + +module.exports = ManagementPolicySchema; diff --git a/lib/services/storageManagement2/lib/models/managementPolicySnapShot.js b/lib/services/storageManagement2/lib/models/managementPolicySnapShot.js new file mode 100644 index 0000000000..e79568a5d8 --- /dev/null +++ b/lib/services/storageManagement2/lib/models/managementPolicySnapShot.js @@ -0,0 +1,56 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Management policy action for snapshot. + * + */ +class ManagementPolicySnapShot { + /** + * Create a ManagementPolicySnapShot. + * @property {object} [deleteProperty] The function to delete the blob + * snapshot + * @property {number} [deleteProperty.daysAfterCreationGreaterThan] Integer + * value indicating the age in days after creation + */ + constructor() { + } + + /** + * Defines the metadata of ManagementPolicySnapShot + * + * @returns {object} metadata of ManagementPolicySnapShot + * + */ + mapper() { + return { + required: false, + serializedName: 'ManagementPolicySnapShot', + type: { + name: 'Composite', + className: 'ManagementPolicySnapShot', + modelProperties: { + deleteProperty: { + required: false, + serializedName: 'delete', + type: { + name: 'Composite', + className: 'DateAfterCreation' + } + } + } + } + }; + } +} + +module.exports = ManagementPolicySnapShot; diff --git a/lib/services/storageManagement2/lib/operations/blobContainers.js b/lib/services/storageManagement2/lib/operations/blobContainers.js index 0476f9c62f..74ddd302a2 100644 --- a/lib/services/storageManagement2/lib/operations/blobContainers.js +++ b/lib/services/storageManagement2/lib/operations/blobContainers.js @@ -53,7 +53,6 @@ function _list(resourceGroupName, accountName, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2018-07-01'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -86,6 +85,15 @@ function _list(resourceGroupName, accountName, options, callback) { throw new Error('"accountName" should satisfy the constraint - "MinLength": 3'); } } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof 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.apiVersion !== null && this.client.apiVersion !== undefined) { + if (this.client.apiVersion.length < 1) + { + throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1'); + } + } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -109,7 +117,7 @@ function _list(resourceGroupName, accountName, options, callback) { requestUrl = requestUrl.replace('{accountName}', encodeURIComponent(accountName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -247,7 +255,6 @@ function _create(resourceGroupName, accountName, containerName, options, callbac } let publicAccess = (options && options.publicAccess !== undefined) ? options.publicAccess : undefined; let metadata = (options && options.metadata !== undefined) ? options.metadata : undefined; - let apiVersion = '2018-07-01'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -293,6 +300,15 @@ function _create(resourceGroupName, accountName, containerName, options, callbac throw new Error('"containerName" should satisfy the constraint - "MinLength": 3'); } } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof 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.apiVersion !== null && this.client.apiVersion !== undefined) { + if (this.client.apiVersion.length < 1) + { + throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1'); + } + } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -323,8 +339,7 @@ function _create(resourceGroupName, accountName, containerName, options, callbac } let blobContainer = new client.models['BlobContainer'](); try { - if ((publicAccess !== null && publicAccess !== undefined) || (metadata !== null && metadata !== undefined)) - { + if ((publicAccess !== null && publicAccess !== undefined) || (metadata !== null && metadata !== undefined)) { blobContainer.publicAccess = publicAccess; blobContainer.metadata = metadata; } @@ -340,7 +355,7 @@ function _create(resourceGroupName, accountName, containerName, options, callbac requestUrl = requestUrl.replace('{containerName}', encodeURIComponent(containerName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -491,7 +506,6 @@ function _update(resourceGroupName, accountName, containerName, options, callbac } let publicAccess = (options && options.publicAccess !== undefined) ? options.publicAccess : undefined; let metadata = (options && options.metadata !== undefined) ? options.metadata : undefined; - let apiVersion = '2018-07-01'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -537,6 +551,15 @@ function _update(resourceGroupName, accountName, containerName, options, callbac throw new Error('"containerName" should satisfy the constraint - "MinLength": 3'); } } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof 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.apiVersion !== null && this.client.apiVersion !== undefined) { + if (this.client.apiVersion.length < 1) + { + throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1'); + } + } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -567,8 +590,7 @@ function _update(resourceGroupName, accountName, containerName, options, callbac } let blobContainer = new client.models['BlobContainer'](); try { - if ((publicAccess !== null && publicAccess !== undefined) || (metadata !== null && metadata !== undefined)) - { + if ((publicAccess !== null && publicAccess !== undefined) || (metadata !== null && metadata !== undefined)) { blobContainer.publicAccess = publicAccess; blobContainer.metadata = metadata; } @@ -584,7 +606,7 @@ function _update(resourceGroupName, accountName, containerName, options, callbac requestUrl = requestUrl.replace('{containerName}', encodeURIComponent(containerName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -724,7 +746,6 @@ function _get(resourceGroupName, accountName, containerName, options, callback) if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2018-07-01'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -770,6 +791,15 @@ function _get(resourceGroupName, accountName, containerName, options, callback) throw new Error('"containerName" should satisfy the constraint - "MinLength": 3'); } } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof 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.apiVersion !== null && this.client.apiVersion !== undefined) { + if (this.client.apiVersion.length < 1) + { + throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1'); + } + } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -794,7 +824,7 @@ function _get(resourceGroupName, accountName, containerName, options, callback) requestUrl = requestUrl.replace('{containerName}', encodeURIComponent(containerName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -919,7 +949,6 @@ function _deleteMethod(resourceGroupName, accountName, containerName, options, c if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2018-07-01'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -965,6 +994,15 @@ function _deleteMethod(resourceGroupName, accountName, containerName, options, c throw new Error('"containerName" should satisfy the constraint - "MinLength": 3'); } } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof 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.apiVersion !== null && this.client.apiVersion !== undefined) { + if (this.client.apiVersion.length < 1) + { + throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1'); + } + } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -989,7 +1027,7 @@ function _deleteMethod(resourceGroupName, accountName, containerName, options, c requestUrl = requestUrl.replace('{containerName}', encodeURIComponent(containerName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1103,7 +1141,6 @@ function _setLegalHold(resourceGroupName, accountName, containerName, tags, opti if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2018-07-01'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -1149,6 +1186,15 @@ function _setLegalHold(resourceGroupName, accountName, containerName, tags, opti throw new Error('"containerName" should satisfy the constraint - "MinLength": 3'); } } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof 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.apiVersion !== null && this.client.apiVersion !== undefined) { + if (this.client.apiVersion.length < 1) + { + throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1'); + } + } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -1174,8 +1220,7 @@ function _setLegalHold(resourceGroupName, accountName, containerName, tags, opti } let legalHold = new client.models['LegalHold'](); try { - if (tags !== null && tags !== undefined) - { + if (tags !== null && tags !== undefined) { legalHold.tags = tags; } } catch (error) { @@ -1190,7 +1235,7 @@ function _setLegalHold(resourceGroupName, accountName, containerName, tags, opti requestUrl = requestUrl.replace('{containerName}', encodeURIComponent(containerName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1335,7 +1380,6 @@ function _clearLegalHold(resourceGroupName, accountName, containerName, tags, op if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2018-07-01'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -1381,6 +1425,15 @@ function _clearLegalHold(resourceGroupName, accountName, containerName, tags, op throw new Error('"containerName" should satisfy the constraint - "MinLength": 3'); } } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof 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.apiVersion !== null && this.client.apiVersion !== undefined) { + if (this.client.apiVersion.length < 1) + { + throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1'); + } + } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -1406,8 +1459,7 @@ function _clearLegalHold(resourceGroupName, accountName, containerName, tags, op } let legalHold = new client.models['LegalHold'](); try { - if (tags !== null && tags !== undefined) - { + if (tags !== null && tags !== undefined) { legalHold.tags = tags; } } catch (error) { @@ -1422,7 +1474,7 @@ function _clearLegalHold(resourceGroupName, accountName, containerName, tags, op requestUrl = requestUrl.replace('{containerName}', encodeURIComponent(containerName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1573,7 +1625,6 @@ function _createOrUpdateImmutabilityPolicy(resourceGroupName, accountName, conta } let ifMatch = (options && options.ifMatch !== undefined) ? options.ifMatch : undefined; let immutabilityPolicyName = 'default'; - let apiVersion = '2018-07-01'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -1619,6 +1670,15 @@ function _createOrUpdateImmutabilityPolicy(resourceGroupName, accountName, conta throw new Error('"containerName" should satisfy the constraint - "MinLength": 3'); } } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof 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.apiVersion !== null && this.client.apiVersion !== undefined) { + if (this.client.apiVersion.length < 1) + { + throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1'); + } + } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -1642,8 +1702,7 @@ function _createOrUpdateImmutabilityPolicy(resourceGroupName, accountName, conta } let parameters; try { - if (immutabilityPeriodSinceCreationInDays !== null && immutabilityPeriodSinceCreationInDays !== undefined) - { + if (immutabilityPeriodSinceCreationInDays !== null && immutabilityPeriodSinceCreationInDays !== undefined) { parameters = new client.models['ImmutabilityPolicy'](); parameters.immutabilityPeriodSinceCreationInDays = immutabilityPeriodSinceCreationInDays; } @@ -1660,7 +1719,7 @@ function _createOrUpdateImmutabilityPolicy(resourceGroupName, accountName, conta requestUrl = requestUrl.replace('{immutabilityPolicyName}', encodeURIComponent(immutabilityPolicyName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1811,7 +1870,6 @@ function _getImmutabilityPolicy(resourceGroupName, accountName, containerName, o } let ifMatch = (options && options.ifMatch !== undefined) ? options.ifMatch : undefined; let immutabilityPolicyName = 'default'; - let apiVersion = '2018-07-01'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -1857,6 +1915,15 @@ function _getImmutabilityPolicy(resourceGroupName, accountName, containerName, o throw new Error('"containerName" should satisfy the constraint - "MinLength": 3'); } } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof 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.apiVersion !== null && this.client.apiVersion !== undefined) { + if (this.client.apiVersion.length < 1) + { + throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1'); + } + } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -1885,7 +1952,7 @@ function _getImmutabilityPolicy(resourceGroupName, accountName, containerName, o requestUrl = requestUrl.replace('{immutabilityPolicyName}', encodeURIComponent(immutabilityPolicyName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -2024,7 +2091,6 @@ function _deleteImmutabilityPolicy(resourceGroupName, accountName, containerName throw new Error('callback cannot be null.'); } let immutabilityPolicyName = 'default'; - let apiVersion = '2018-07-01'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -2070,6 +2136,15 @@ function _deleteImmutabilityPolicy(resourceGroupName, accountName, containerName throw new Error('"containerName" should satisfy the constraint - "MinLength": 3'); } } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof 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.apiVersion !== null && this.client.apiVersion !== undefined) { + if (this.client.apiVersion.length < 1) + { + throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1'); + } + } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -2098,7 +2173,7 @@ function _deleteImmutabilityPolicy(resourceGroupName, accountName, containerName requestUrl = requestUrl.replace('{immutabilityPolicyName}', encodeURIComponent(immutabilityPolicyName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -2234,7 +2309,6 @@ function _lockImmutabilityPolicy(resourceGroupName, accountName, containerName, if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2018-07-01'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -2280,6 +2354,15 @@ function _lockImmutabilityPolicy(resourceGroupName, accountName, containerName, throw new Error('"containerName" should satisfy the constraint - "MinLength": 3'); } } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof 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.apiVersion !== null && this.client.apiVersion !== undefined) { + if (this.client.apiVersion.length < 1) + { + throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1'); + } + } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -2307,7 +2390,7 @@ function _lockImmutabilityPolicy(resourceGroupName, accountName, containerName, requestUrl = requestUrl.replace('{containerName}', encodeURIComponent(containerName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -2446,7 +2529,6 @@ function _extendImmutabilityPolicy(resourceGroupName, accountName, containerName if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2018-07-01'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -2492,6 +2574,15 @@ function _extendImmutabilityPolicy(resourceGroupName, accountName, containerName throw new Error('"containerName" should satisfy the constraint - "MinLength": 3'); } } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof 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.apiVersion !== null && this.client.apiVersion !== undefined) { + if (this.client.apiVersion.length < 1) + { + throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1'); + } + } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -2515,8 +2606,7 @@ function _extendImmutabilityPolicy(resourceGroupName, accountName, containerName } let parameters; try { - if (immutabilityPeriodSinceCreationInDays !== null && immutabilityPeriodSinceCreationInDays !== undefined) - { + if (immutabilityPeriodSinceCreationInDays !== null && immutabilityPeriodSinceCreationInDays !== undefined) { parameters = new client.models['ImmutabilityPolicy'](); parameters.immutabilityPeriodSinceCreationInDays = immutabilityPeriodSinceCreationInDays; } @@ -2532,7 +2622,7 @@ function _extendImmutabilityPolicy(resourceGroupName, accountName, containerName requestUrl = requestUrl.replace('{containerName}', encodeURIComponent(containerName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } diff --git a/lib/services/storageManagement2/lib/operations/blobServices.js b/lib/services/storageManagement2/lib/operations/blobServices.js index 4f0e1f9ac9..b5c8ebe054 100644 --- a/lib/services/storageManagement2/lib/operations/blobServices.js +++ b/lib/services/storageManagement2/lib/operations/blobServices.js @@ -81,7 +81,6 @@ function _setServiceProperties(resourceGroupName, accountName, parameters, optio if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2018-07-01'; let blobServicesName = 'default'; // Validate try { @@ -115,6 +114,15 @@ function _setServiceProperties(resourceGroupName, accountName, parameters, optio throw new Error('"accountName" should satisfy the constraint - "MinLength": 3'); } } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof 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.apiVersion !== null && this.client.apiVersion !== undefined) { + if (this.client.apiVersion.length < 1) + { + throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1'); + } + } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -142,7 +150,7 @@ function _setServiceProperties(resourceGroupName, accountName, parameters, optio requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{BlobServicesName}', encodeURIComponent(blobServicesName)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -278,7 +286,6 @@ function _getServiceProperties(resourceGroupName, accountName, options, callback if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2018-07-01'; let blobServicesName = 'default'; // Validate try { @@ -312,6 +319,15 @@ function _getServiceProperties(resourceGroupName, accountName, options, callback throw new Error('"accountName" should satisfy the constraint - "MinLength": 3'); } } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof 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.apiVersion !== null && this.client.apiVersion !== undefined) { + if (this.client.apiVersion.length < 1) + { + throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1'); + } + } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -336,7 +352,7 @@ function _getServiceProperties(resourceGroupName, accountName, options, callback requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{BlobServicesName}', encodeURIComponent(blobServicesName)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } diff --git a/lib/services/storageManagement2/lib/operations/index.d.ts b/lib/services/storageManagement2/lib/operations/index.d.ts index 3c3a7879f6..3ec07191fa 100644 --- a/lib/services/storageManagement2/lib/operations/index.d.ts +++ b/lib/services/storageManagement2/lib/operations/index.d.ts @@ -1969,6 +1969,225 @@ export interface Usages { listByLocation(location: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } +/** + * @class + * ManagementPolicies + * __NOTE__: An instance of this class is automatically created for an + * instance of the StorageManagementClient. + */ +export interface ManagementPolicies { + + + /** + * Gets the managementpolicy associated with the specified storage account. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} accountName The name of the storage account within the + * specified resource group. Storage account names must be between 3 and 24 + * characters in length and use numbers and lower-case letters only. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, accountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the managementpolicy associated with the specified storage account. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} accountName The name of the storage account within the + * specified resource group. Storage account names must be between 3 and 24 + * characters in length and use numbers and lower-case letters only. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ManagementPolicy} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ManagementPolicy} [result] - The deserialized result object if an error did not occur. + * See {@link ManagementPolicy} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, accountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, accountName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, accountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Sets the managementpolicy to the specified storage account. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} accountName The name of the storage account within the + * specified resource group. Storage account names must be between 3 and 24 + * characters in length and use numbers and lower-case letters only. + * + * @param {object} policy The Storage Account ManagementPolicy, in JSON format. + * See more details in: + * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + * + * @param {array} policy.rules The Storage Account ManagementPolicies Rules. + * See more details in: + * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, accountName: string, policy: models.ManagementPolicySchema, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Sets the managementpolicy to the specified storage account. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} accountName The name of the storage account within the + * specified resource group. Storage account names must be between 3 and 24 + * characters in length and use numbers and lower-case letters only. + * + * @param {object} policy The Storage Account ManagementPolicy, in JSON format. + * See more details in: + * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + * + * @param {array} policy.rules The Storage Account ManagementPolicies Rules. + * See more details in: + * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ManagementPolicy} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ManagementPolicy} [result] - The deserialized result object if an error did not occur. + * See {@link ManagementPolicy} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, accountName: string, policy: models.ManagementPolicySchema, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, accountName: string, policy: models.ManagementPolicySchema, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, accountName: string, policy: models.ManagementPolicySchema, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the managementpolicy associated with the specified storage account. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} accountName The name of the storage account within the + * specified resource group. Storage account names must be between 3 and 24 + * characters in length and use numbers and lower-case letters only. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, accountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the managementpolicy associated with the specified storage account. + * + * @param {string} resourceGroupName The name of the resource group within the + * user's subscription. The name is case insensitive. + * + * @param {string} accountName The name of the storage account within the + * specified resource group. Storage account names must be between 3 and 24 + * characters in length and use numbers and lower-case letters only. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, accountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, accountName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, accountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + /** * @class * BlobServices @@ -3231,216 +3450,3 @@ export interface BlobContainers { extendImmutabilityPolicy(resourceGroupName: string, accountName: string, containerName: string, ifMatch: string, immutabilityPeriodSinceCreationInDays: number, callback: ServiceCallback): void; extendImmutabilityPolicy(resourceGroupName: string, accountName: string, containerName: string, ifMatch: string, immutabilityPeriodSinceCreationInDays: number, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } - -/** - * @class - * ManagementPolicies - * __NOTE__: An instance of this class is automatically created for an - * instance of the StorageManagementClient. - */ -export interface ManagementPolicies { - - - /** - * Gets the data policy rules associated with the specified storage account. - * - * @param {string} resourceGroupName The name of the resource group within the - * user's subscription. The name is case insensitive. - * - * @param {string} accountName The name of the storage account within the - * specified resource group. Storage account names must be between 3 and 24 - * characters in length and use numbers and lower-case letters only. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @returns {Promise} A promise is returned - * - * @resolve {HttpOperationResponse} - The deserialized result object. - * - * @reject {Error|ServiceError} - The error object. - */ - getWithHttpOperationResponse(resourceGroupName: string, accountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Gets the data policy rules associated with the specified storage account. - * - * @param {string} resourceGroupName The name of the resource group within the - * user's subscription. The name is case insensitive. - * - * @param {string} accountName The name of the storage account within the - * specified resource group. Storage account names must be between 3 and 24 - * characters in length and use numbers and lower-case letters only. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @param {ServiceCallback} [optionalCallback] - The optional callback. - * - * @returns {ServiceCallback|Promise} If a callback was passed as the last - * parameter then it returns the callback else returns a Promise. - * - * {Promise} A promise is returned. - * - * @resolve {StorageAccountManagementPolicies} - The deserialized result object. - * - * @reject {Error|ServiceError} - The error object. - * - * {ServiceCallback} optionalCallback(err, result, request, response) - * - * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. - * - * {StorageAccountManagementPolicies} [result] - The deserialized result object if an error did not occur. - * See {@link StorageAccountManagementPolicies} for more - * information. - * - * {WebResource} [request] - The HTTP Request object if an error did not occur. - * - * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. - */ - get(resourceGroupName: string, accountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, accountName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, accountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Sets the data policy rules associated with the specified storage account. - * - * @param {string} resourceGroupName The name of the resource group within the - * user's subscription. The name is case insensitive. - * - * @param {string} accountName The name of the storage account within the - * specified resource group. Storage account names must be between 3 and 24 - * characters in length and use numbers and lower-case letters only. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.policy] The Storage Account ManagementPolicies - * Rules, in JSON format. See more details in: - * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @returns {Promise} A promise is returned - * - * @resolve {HttpOperationResponse} - The deserialized result object. - * - * @reject {Error|ServiceError} - The error object. - */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, accountName: string, options?: { policy? : any, customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Sets the data policy rules associated with the specified storage account. - * - * @param {string} resourceGroupName The name of the resource group within the - * user's subscription. The name is case insensitive. - * - * @param {string} accountName The name of the storage account within the - * specified resource group. Storage account names must be between 3 and 24 - * characters in length and use numbers and lower-case letters only. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.policy] The Storage Account ManagementPolicies - * Rules, in JSON format. See more details in: - * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @param {ServiceCallback} [optionalCallback] - The optional callback. - * - * @returns {ServiceCallback|Promise} If a callback was passed as the last - * parameter then it returns the callback else returns a Promise. - * - * {Promise} A promise is returned. - * - * @resolve {StorageAccountManagementPolicies} - The deserialized result object. - * - * @reject {Error|ServiceError} - The error object. - * - * {ServiceCallback} optionalCallback(err, result, request, response) - * - * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. - * - * {StorageAccountManagementPolicies} [result] - The deserialized result object if an error did not occur. - * See {@link StorageAccountManagementPolicies} for more - * information. - * - * {WebResource} [request] - The HTTP Request object if an error did not occur. - * - * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. - */ - createOrUpdate(resourceGroupName: string, accountName: string, options?: { policy? : any, customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, accountName: string, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, accountName: string, options: { policy? : any, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Deletes the data policy rules associated with the specified storage account. - * - * @param {string} resourceGroupName The name of the resource group within the - * user's subscription. The name is case insensitive. - * - * @param {string} accountName The name of the storage account within the - * specified resource group. Storage account names must be between 3 and 24 - * characters in length and use numbers and lower-case letters only. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @returns {Promise} A promise is returned - * - * @resolve {HttpOperationResponse} - The deserialized result object. - * - * @reject {Error|ServiceError} - The error object. - */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, accountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Deletes the data policy rules associated with the specified storage account. - * - * @param {string} resourceGroupName The name of the resource group within the - * user's subscription. The name is case insensitive. - * - * @param {string} accountName The name of the storage account within the - * specified resource group. Storage account names must be between 3 and 24 - * characters in length and use numbers and lower-case letters only. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @param {ServiceCallback} [optionalCallback] - The optional callback. - * - * @returns {ServiceCallback|Promise} If a callback was passed as the last - * parameter then it returns the callback else returns a Promise. - * - * {Promise} A promise is returned. - * - * @resolve {null} - The deserialized result object. - * - * @reject {Error|ServiceError} - The error object. - * - * {ServiceCallback} optionalCallback(err, result, request, response) - * - * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. - * - * {null} [result] - The deserialized result object if an error did not occur. - * - * {WebResource} [request] - The HTTP Request object if an error did not occur. - * - * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. - */ - deleteMethod(resourceGroupName: string, accountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, accountName: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, accountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} diff --git a/lib/services/storageManagement2/lib/operations/index.js b/lib/services/storageManagement2/lib/operations/index.js index 2ebae33bd1..eafb88b48d 100644 --- a/lib/services/storageManagement2/lib/operations/index.js +++ b/lib/services/storageManagement2/lib/operations/index.js @@ -18,6 +18,6 @@ exports.Operations = require('./operations'); exports.Skus = require('./skus'); exports.StorageAccounts = require('./storageAccounts'); exports.Usages = require('./usages'); +exports.ManagementPolicies = require('./managementPolicies'); exports.BlobServices = require('./blobServices'); exports.BlobContainers = require('./blobContainers'); -exports.ManagementPolicies = require('./managementPolicies'); diff --git a/lib/services/storageManagement2/lib/operations/managementPolicies.js b/lib/services/storageManagement2/lib/operations/managementPolicies.js index 875da78523..abd6efcd26 100644 --- a/lib/services/storageManagement2/lib/operations/managementPolicies.js +++ b/lib/services/storageManagement2/lib/operations/managementPolicies.js @@ -15,7 +15,7 @@ const msRestAzure = require('ms-rest-azure'); const WebResource = msRest.WebResource; /** - * Gets the data policy rules associated with the specified storage account. + * Gets the managementpolicy associated with the specified storage account. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -36,8 +36,7 @@ const WebResource = msRest.WebResource; * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link StorageAccountManagementPolicies} for more - * information. + * See {@link ManagementPolicy} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * @@ -53,7 +52,6 @@ function _get(resourceGroupName, accountName, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2018-03-01-preview'; let managementPolicyName = 'default'; // Validate try { @@ -87,6 +85,15 @@ function _get(resourceGroupName, accountName, options, callback) { throw new Error('"accountName" should satisfy the constraint - "MinLength": 3'); } } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof 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.apiVersion !== null && this.client.apiVersion !== undefined) { + if (this.client.apiVersion.length < 1) + { + throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1'); + } + } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -111,7 +118,7 @@ function _get(resourceGroupName, accountName, options, callback) { requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{managementPolicyName}', encodeURIComponent(managementPolicyName)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -178,7 +185,7 @@ function _get(resourceGroupName, accountName, options, callback) { parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['StorageAccountManagementPolicies']().mapper(); + let resultMapper = new client.models['ManagementPolicy']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -194,7 +201,7 @@ function _get(resourceGroupName, accountName, options, callback) { } /** - * Sets the data policy rules associated with the specified storage account. + * Sets the managementpolicy to the specified storage account. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -203,12 +210,16 @@ function _get(resourceGroupName, accountName, options, callback) { * specified resource group. Storage account names must be between 3 and 24 * characters in length and use numbers and lower-case letters only. * - * @param {object} [options] Optional Parameters. + * @param {object} policy The Storage Account ManagementPolicy, in JSON format. + * See more details in: + * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. * - * @param {object} [options.policy] The Storage Account ManagementPolicies - * Rules, in JSON format. See more details in: + * @param {array} policy.rules The Storage Account ManagementPolicies Rules. + * See more details in: * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. * + * @param {object} [options] Optional Parameters. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -219,14 +230,13 @@ function _get(resourceGroupName, accountName, options, callback) { * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link StorageAccountManagementPolicies} for more - * information. + * See {@link ManagementPolicy} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _createOrUpdate(resourceGroupName, accountName, options, callback) { +function _createOrUpdate(resourceGroupName, accountName, policy, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -236,8 +246,6 @@ function _createOrUpdate(resourceGroupName, accountName, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let policy = (options && options.policy !== undefined) ? options.policy : undefined; - let apiVersion = '2018-03-01-preview'; let managementPolicyName = 'default'; // Validate try { @@ -271,6 +279,15 @@ function _createOrUpdate(resourceGroupName, accountName, options, callback) { throw new Error('"accountName" should satisfy the constraint - "MinLength": 3'); } } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof 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.apiVersion !== null && this.client.apiVersion !== undefined) { + if (this.client.apiVersion.length < 1) + { + throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1'); + } + } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -280,8 +297,8 @@ function _createOrUpdate(resourceGroupName, accountName, options, callback) { throw new Error('"this.client.subscriptionId" should satisfy the constraint - "MinLength": 1'); } } - if (policy !== null && policy !== undefined && typeof policy !== 'object') { - throw new Error('policy must be of type object.'); + if (policy === null || policy === undefined) { + throw new Error('policy 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.'); @@ -289,10 +306,13 @@ function _createOrUpdate(resourceGroupName, accountName, options, callback) { } catch (error) { return callback(error); } - let properties; - if (policy !== null && policy !== undefined) { - properties = new client.models['ManagementPoliciesRulesSetParameter'](); - properties.policy = policy; + let properties = new client.models['ManagementPolicy'](); + try { + if (policy !== null && policy !== undefined) { + properties.policy = policy; + } + } catch (error) { + return callback(error); } // Construct URL @@ -303,7 +323,7 @@ function _createOrUpdate(resourceGroupName, accountName, options, callback) { requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{managementPolicyName}', encodeURIComponent(managementPolicyName)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -333,7 +353,7 @@ function _createOrUpdate(resourceGroupName, accountName, options, callback) { let requestModel = null; try { if (properties !== null && properties !== undefined) { - let requestModelMapper = new client.models['ManagementPoliciesRulesSetParameter']().mapper(); + let requestModelMapper = new client.models['ManagementPolicy']().mapper(); requestModel = client.serialize(requestModelMapper, properties, 'properties'); requestContent = JSON.stringify(requestModel); } @@ -384,7 +404,7 @@ function _createOrUpdate(resourceGroupName, accountName, options, callback) { parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['StorageAccountManagementPolicies']().mapper(); + let resultMapper = new client.models['ManagementPolicy']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -400,7 +420,7 @@ function _createOrUpdate(resourceGroupName, accountName, options, callback) { } /** - * Deletes the data policy rules associated with the specified storage account. + * Deletes the managementpolicy associated with the specified storage account. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -436,7 +456,6 @@ function _deleteMethod(resourceGroupName, accountName, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2018-03-01-preview'; let managementPolicyName = 'default'; // Validate try { @@ -470,6 +489,15 @@ function _deleteMethod(resourceGroupName, accountName, options, callback) { throw new Error('"accountName" should satisfy the constraint - "MinLength": 3'); } } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof 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.apiVersion !== null && this.client.apiVersion !== undefined) { + if (this.client.apiVersion.length < 1) + { + throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1'); + } + } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -494,7 +522,7 @@ function _deleteMethod(resourceGroupName, accountName, options, callback) { requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{managementPolicyName}', encodeURIComponent(managementPolicyName)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -573,7 +601,7 @@ class ManagementPolicies { } /** - * Gets the data policy rules associated with the specified storage account. + * Gets the managementpolicy associated with the specified storage account. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -589,7 +617,7 @@ class ManagementPolicies { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ @@ -608,7 +636,7 @@ class ManagementPolicies { } /** - * Gets the data policy rules associated with the specified storage account. + * Gets the managementpolicy associated with the specified storage account. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -629,7 +657,7 @@ class ManagementPolicies { * * {Promise} A promise is returned * - * @resolve {StorageAccountManagementPolicies} - The deserialized result object. + * @resolve {ManagementPolicy} - The deserialized result object. * * @reject {Error} - The error object. * @@ -638,8 +666,7 @@ class ManagementPolicies { * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link StorageAccountManagementPolicies} for more - * information. + * See {@link ManagementPolicy} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * @@ -666,7 +693,7 @@ class ManagementPolicies { } /** - * Sets the data policy rules associated with the specified storage account. + * Sets the managementpolicy to the specified storage account. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -675,26 +702,30 @@ class ManagementPolicies { * specified resource group. Storage account names must be between 3 and 24 * characters in length and use numbers and lower-case letters only. * - * @param {object} [options] Optional Parameters. + * @param {object} policy The Storage Account ManagementPolicy, in JSON format. + * See more details in: + * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. * - * @param {object} [options.policy] The Storage Account ManagementPolicies - * Rules, in JSON format. See more details in: + * @param {array} policy.rules The Storage Account ManagementPolicies Rules. + * See more details in: * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. * + * @param {object} [options] Optional Parameters. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName, accountName, options) { + createOrUpdateWithHttpOperationResponse(resourceGroupName, accountName, policy, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._createOrUpdate(resourceGroupName, accountName, options, (err, result, request, response) => { + self._createOrUpdate(resourceGroupName, accountName, policy, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -705,7 +736,7 @@ class ManagementPolicies { } /** - * Sets the data policy rules associated with the specified storage account. + * Sets the managementpolicy to the specified storage account. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -714,12 +745,16 @@ class ManagementPolicies { * specified resource group. Storage account names must be between 3 and 24 * characters in length and use numbers and lower-case letters only. * - * @param {object} [options] Optional Parameters. + * @param {object} policy The Storage Account ManagementPolicy, in JSON format. + * See more details in: + * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. * - * @param {object} [options.policy] The Storage Account ManagementPolicies - * Rules, in JSON format. See more details in: + * @param {array} policy.rules The Storage Account ManagementPolicies Rules. + * See more details in: * https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts. * + * @param {object} [options] Optional Parameters. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -730,7 +765,7 @@ class ManagementPolicies { * * {Promise} A promise is returned * - * @resolve {StorageAccountManagementPolicies} - The deserialized result object. + * @resolve {ManagementPolicy} - The deserialized result object. * * @reject {Error} - The error object. * @@ -739,14 +774,13 @@ class ManagementPolicies { * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link StorageAccountManagementPolicies} for more - * information. + * See {@link ManagementPolicy} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - createOrUpdate(resourceGroupName, accountName, options, optionalCallback) { + createOrUpdate(resourceGroupName, accountName, policy, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -755,19 +789,19 @@ class ManagementPolicies { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._createOrUpdate(resourceGroupName, accountName, options, (err, result, request, response) => { + self._createOrUpdate(resourceGroupName, accountName, policy, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._createOrUpdate(resourceGroupName, accountName, options, optionalCallback); + return self._createOrUpdate(resourceGroupName, accountName, policy, options, optionalCallback); } } /** - * Deletes the data policy rules associated with the specified storage account. + * Deletes the managementpolicy associated with the specified storage account. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. @@ -802,7 +836,7 @@ class ManagementPolicies { } /** - * Deletes the data policy rules associated with the specified storage account. + * Deletes the managementpolicy associated with the specified storage account. * * @param {string} resourceGroupName The name of the resource group within the * user's subscription. The name is case insensitive. diff --git a/lib/services/storageManagement2/lib/operations/operations.js b/lib/services/storageManagement2/lib/operations/operations.js index 5c94afdf5d..b88d253ec5 100644 --- a/lib/services/storageManagement2/lib/operations/operations.js +++ b/lib/services/storageManagement2/lib/operations/operations.js @@ -45,9 +45,17 @@ function _list(options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2018-07-01'; // Validate try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion !== null && this.client.apiVersion !== undefined) { + if (this.client.apiVersion.length < 1) + { + throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1'); + } + } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -59,7 +67,7 @@ function _list(options, callback) { let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Storage/operations'; let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } diff --git a/lib/services/storageManagement2/lib/operations/skus.js b/lib/services/storageManagement2/lib/operations/skus.js index 921e4e3c16..3bc96c9d5c 100644 --- a/lib/services/storageManagement2/lib/operations/skus.js +++ b/lib/services/storageManagement2/lib/operations/skus.js @@ -46,9 +46,17 @@ function _list(options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2018-07-01'; // Validate try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion !== null && this.client.apiVersion !== undefined) { + if (this.client.apiVersion.length < 1) + { + throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1'); + } + } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -70,7 +78,7 @@ function _list(options, callback) { let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Storage/skus'; requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } diff --git a/lib/services/storageManagement2/lib/operations/storageAccounts.js b/lib/services/storageManagement2/lib/operations/storageAccounts.js index ef9a6f865d..fd0a3dc9b9 100644 --- a/lib/services/storageManagement2/lib/operations/storageAccounts.js +++ b/lib/services/storageManagement2/lib/operations/storageAccounts.js @@ -48,9 +48,17 @@ function _checkNameAvailability(name, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2018-07-01'; // Validate try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion !== null && this.client.apiVersion !== undefined) { + if (this.client.apiVersion.length < 1) + { + throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1'); + } + } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -71,8 +79,7 @@ function _checkNameAvailability(name, options, callback) { } let accountName = new client.models['StorageAccountCheckNameAvailabilityParameters'](); try { - if (name !== null && name !== undefined) - { + if (name !== null && name !== undefined) { accountName.name = name; } } catch (error) { @@ -84,7 +91,7 @@ function _checkNameAvailability(name, options, callback) { let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'; requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -409,7 +416,6 @@ function _deleteMethod(resourceGroupName, accountName, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2018-07-01'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -442,6 +448,15 @@ function _deleteMethod(resourceGroupName, accountName, options, callback) { throw new Error('"accountName" should satisfy the constraint - "MinLength": 3'); } } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof 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.apiVersion !== null && this.client.apiVersion !== undefined) { + if (this.client.apiVersion.length < 1) + { + throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1'); + } + } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -465,7 +480,7 @@ function _deleteMethod(resourceGroupName, accountName, options, callback) { requestUrl = requestUrl.replace('{accountName}', encodeURIComponent(accountName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -576,7 +591,6 @@ function _getProperties(resourceGroupName, accountName, options, callback) { throw new Error('callback cannot be null.'); } let expand = (options && options.expand !== undefined) ? options.expand : undefined; - let apiVersion = '2018-07-01'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -609,6 +623,15 @@ function _getProperties(resourceGroupName, accountName, options, callback) { throw new Error('"accountName" should satisfy the constraint - "MinLength": 3'); } } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof 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.apiVersion !== null && this.client.apiVersion !== undefined) { + if (this.client.apiVersion.length < 1) + { + throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1'); + } + } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -638,7 +661,7 @@ function _getProperties(resourceGroupName, accountName, options, callback) { requestUrl = requestUrl.replace('{accountName}', encodeURIComponent(accountName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (expand !== null && expand !== undefined) { queryParameters.push('$expand=' + encodeURIComponent(expand)); } @@ -873,7 +896,6 @@ function _update(resourceGroupName, accountName, parameters, options, callback) { parameters = {}; } - let apiVersion = '2018-07-01'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -909,6 +931,15 @@ function _update(resourceGroupName, accountName, parameters, options, callback) 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.apiVersion !== null && this.client.apiVersion !== undefined) { + if (this.client.apiVersion.length < 1) + { + throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1'); + } + } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -932,7 +963,7 @@ function _update(resourceGroupName, accountName, parameters, options, callback) requestUrl = requestUrl.replace('{accountName}', encodeURIComponent(accountName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1061,9 +1092,17 @@ function _list(options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2018-07-01'; // Validate try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion !== null && this.client.apiVersion !== undefined) { + if (this.client.apiVersion.length < 1) + { + throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1'); + } + } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -1085,7 +1124,7 @@ function _list(options, callback) { let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'; requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1204,7 +1243,6 @@ function _listByResourceGroup(resourceGroupName, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2018-07-01'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -1224,6 +1262,15 @@ function _listByResourceGroup(resourceGroupName, options, callback) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); } } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof 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.apiVersion !== null && this.client.apiVersion !== undefined) { + if (this.client.apiVersion.length < 1) + { + throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1'); + } + } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -1246,7 +1293,7 @@ function _listByResourceGroup(resourceGroupName, options, callback) { requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1367,7 +1414,6 @@ function _listKeys(resourceGroupName, accountName, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2018-07-01'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -1400,6 +1446,15 @@ function _listKeys(resourceGroupName, accountName, options, callback) { throw new Error('"accountName" should satisfy the constraint - "MinLength": 3'); } } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof 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.apiVersion !== null && this.client.apiVersion !== undefined) { + if (this.client.apiVersion.length < 1) + { + throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1'); + } + } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -1423,7 +1478,7 @@ function _listKeys(resourceGroupName, accountName, options, callback) { requestUrl = requestUrl.replace('{accountName}', encodeURIComponent(accountName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1547,7 +1602,6 @@ function _regenerateKey(resourceGroupName, accountName, keyName, options, callba if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2018-07-01'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -1580,6 +1634,15 @@ function _regenerateKey(resourceGroupName, accountName, keyName, options, callba throw new Error('"accountName" should satisfy the constraint - "MinLength": 3'); } } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof 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.apiVersion !== null && this.client.apiVersion !== undefined) { + if (this.client.apiVersion.length < 1) + { + throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1'); + } + } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -1611,7 +1674,7 @@ function _regenerateKey(resourceGroupName, accountName, keyName, options, callba requestUrl = requestUrl.replace('{accountName}', encodeURIComponent(accountName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1779,7 +1842,6 @@ function _listAccountSAS(resourceGroupName, accountName, parameters, options, ca if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2018-07-01'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -1815,6 +1877,15 @@ function _listAccountSAS(resourceGroupName, accountName, parameters, options, ca 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.apiVersion !== null && this.client.apiVersion !== undefined) { + if (this.client.apiVersion.length < 1) + { + throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1'); + } + } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -1838,7 +1909,7 @@ function _listAccountSAS(resourceGroupName, accountName, parameters, options, ca requestUrl = requestUrl.replace('{accountName}', encodeURIComponent(accountName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -2030,7 +2101,6 @@ function _listServiceSAS(resourceGroupName, accountName, parameters, options, ca if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2018-07-01'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -2066,6 +2136,15 @@ function _listServiceSAS(resourceGroupName, accountName, parameters, options, ca 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.apiVersion !== null && this.client.apiVersion !== undefined) { + if (this.client.apiVersion.length < 1) + { + throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1'); + } + } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -2089,7 +2168,7 @@ function _listServiceSAS(resourceGroupName, accountName, parameters, options, ca requestUrl = requestUrl.replace('{accountName}', encodeURIComponent(accountName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -2407,7 +2486,6 @@ function _beginCreate(resourceGroupName, accountName, parameters, options, callb { parameters = {}; } - let apiVersion = '2018-07-01'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -2443,6 +2521,15 @@ function _beginCreate(resourceGroupName, accountName, parameters, options, callb 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.apiVersion !== null && this.client.apiVersion !== undefined) { + if (this.client.apiVersion.length < 1) + { + throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1'); + } + } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -2466,7 +2553,7 @@ function _beginCreate(resourceGroupName, accountName, parameters, options, callb requestUrl = requestUrl.replace('{accountName}', encodeURIComponent(accountName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -2602,7 +2689,6 @@ function _beginFailover(resourceGroupName, accountName, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2018-07-01'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -2635,6 +2721,15 @@ function _beginFailover(resourceGroupName, accountName, options, callback) { throw new Error('"accountName" should satisfy the constraint - "MinLength": 3'); } } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof 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.apiVersion !== null && this.client.apiVersion !== undefined) { + if (this.client.apiVersion.length < 1) + { + throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1'); + } + } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -2658,7 +2753,7 @@ function _beginFailover(resourceGroupName, accountName, options, callback) { requestUrl = requestUrl.replace('{accountName}', encodeURIComponent(accountName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } diff --git a/lib/services/storageManagement2/lib/operations/usages.js b/lib/services/storageManagement2/lib/operations/usages.js index ff9e10f11f..bb6adfc815 100644 --- a/lib/services/storageManagement2/lib/operations/usages.js +++ b/lib/services/storageManagement2/lib/operations/usages.js @@ -48,9 +48,17 @@ function _listByLocation(location, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2018-07-01'; // Validate try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion !== null && this.client.apiVersion !== undefined) { + if (this.client.apiVersion.length < 1) + { + throw new Error('"this.client.apiVersion" should satisfy the constraint - "MinLength": 1'); + } + } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } @@ -76,7 +84,7 @@ function _listByLocation(location, options, callback) { requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{location}', encodeURIComponent(location)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } diff --git a/lib/services/storageManagement2/lib/storageManagementClient.d.ts b/lib/services/storageManagement2/lib/storageManagementClient.d.ts index b14177748e..ec720da9bb 100644 --- a/lib/services/storageManagement2/lib/storageManagementClient.d.ts +++ b/lib/services/storageManagement2/lib/storageManagementClient.d.ts @@ -47,6 +47,8 @@ export default class StorageManagementClient extends AzureServiceClient { subscriptionId: string; + apiVersion: string; + acceptLanguage: string; longRunningOperationRetryTimeout: number; @@ -58,9 +60,9 @@ export default class StorageManagementClient extends AzureServiceClient { skus: operations.Skus; storageAccounts: operations.StorageAccounts; usages: operations.Usages; + managementPolicies: operations.ManagementPolicies; blobServices: operations.BlobServices; blobContainers: operations.BlobContainers; - managementPolicies: operations.ManagementPolicies; } export { StorageManagementClient, models as StorageManagementModels }; diff --git a/lib/services/storageManagement2/lib/storageManagementClient.js b/lib/services/storageManagement2/lib/storageManagementClient.js index 3b2b49d994..acda63c35c 100644 --- a/lib/services/storageManagement2/lib/storageManagementClient.js +++ b/lib/services/storageManagement2/lib/storageManagementClient.js @@ -50,6 +50,7 @@ class StorageManagementClient extends ServiceClient { super(credentials, options); + this.apiVersion = '2018-11-01'; this.acceptLanguage = 'en-US'; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; @@ -75,9 +76,9 @@ class StorageManagementClient extends ServiceClient { this.skus = new operations.Skus(this); this.storageAccounts = new operations.StorageAccounts(this); this.usages = new operations.Usages(this); + this.managementPolicies = new operations.ManagementPolicies(this); this.blobServices = new operations.BlobServices(this); this.blobContainers = new operations.BlobContainers(this); - this.managementPolicies = new operations.ManagementPolicies(this); this.models = models; msRest.addSerializationMixin(this); }