diff --git a/lib/services/sqlManagement2/lib/models/databaseUpdate.js b/lib/services/sqlManagement2/lib/models/databaseUpdate.js index d6be153bc4..0f939e0ed1 100644 --- a/lib/services/sqlManagement2/lib/models/databaseUpdate.js +++ b/lib/services/sqlManagement2/lib/models/databaseUpdate.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * A database resource. * diff --git a/lib/services/sqlManagement2/lib/models/databaseVulnerabilityAssessment.js b/lib/services/sqlManagement2/lib/models/databaseVulnerabilityAssessment.js index 375f0771a8..34fd870857 100644 --- a/lib/services/sqlManagement2/lib/models/databaseVulnerabilityAssessment.js +++ b/lib/services/sqlManagement2/lib/models/databaseVulnerabilityAssessment.js @@ -23,9 +23,13 @@ class DatabaseVulnerabilityAssessment extends models['ProxyResource'] { * @member {string} storageContainerPath A blob storage container path to * hold the scan results (e.g. * https://myStorage.blob.core.windows.net/VaScans/). - * @member {string} storageContainerSasKey A shared access signature (SAS + * @member {string} [storageContainerSasKey] A shared access signature (SAS * Key) that has write access to the blob container specified in - * 'storageContainerPath' parameter. + * 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't + * specified, StorageContainerSasKey is required. + * @member {string} [storageAccountAccessKey] Specifies the identifier key of + * the vulnerability assessment storage account. If 'StorageContainerSasKey' + * isn't specified, storageAccountAccessKey is required. * @member {object} [recurringScans] The recurring scans settings * @member {boolean} [recurringScans.isEnabled] Recurring scans state. * @member {boolean} [recurringScans.emailSubscriptionAdmins] Specifies that @@ -84,12 +88,19 @@ class DatabaseVulnerabilityAssessment extends models['ProxyResource'] { } }, storageContainerSasKey: { - required: true, + required: false, serializedName: 'properties.storageContainerSasKey', type: { name: 'String' } }, + storageAccountAccessKey: { + required: false, + serializedName: 'properties.storageAccountAccessKey', + type: { + name: 'String' + } + }, recurringScans: { required: false, serializedName: 'properties.recurringScans', diff --git a/lib/services/sqlManagement2/lib/models/editionCapability.js b/lib/services/sqlManagement2/lib/models/editionCapability.js index 91c33a3d6d..6c5c215d90 100644 --- a/lib/services/sqlManagement2/lib/models/editionCapability.js +++ b/lib/services/sqlManagement2/lib/models/editionCapability.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The edition capability. * diff --git a/lib/services/sqlManagement2/lib/models/elasticPoolEditionCapability.js b/lib/services/sqlManagement2/lib/models/elasticPoolEditionCapability.js index 8363d79a3f..d04d7bc292 100644 --- a/lib/services/sqlManagement2/lib/models/elasticPoolEditionCapability.js +++ b/lib/services/sqlManagement2/lib/models/elasticPoolEditionCapability.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The elastic pool edition capability. * diff --git a/lib/services/sqlManagement2/lib/models/elasticPoolPerDatabaseMaxPerformanceLevelCapability.js b/lib/services/sqlManagement2/lib/models/elasticPoolPerDatabaseMaxPerformanceLevelCapability.js index 693b58f5d3..e7bc6fa05e 100644 --- a/lib/services/sqlManagement2/lib/models/elasticPoolPerDatabaseMaxPerformanceLevelCapability.js +++ b/lib/services/sqlManagement2/lib/models/elasticPoolPerDatabaseMaxPerformanceLevelCapability.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The max per-database performance level capability. * diff --git a/lib/services/sqlManagement2/lib/models/elasticPoolPerformanceLevelCapability.js b/lib/services/sqlManagement2/lib/models/elasticPoolPerformanceLevelCapability.js index a86cd0b087..60d33e1c8b 100644 --- a/lib/services/sqlManagement2/lib/models/elasticPoolPerformanceLevelCapability.js +++ b/lib/services/sqlManagement2/lib/models/elasticPoolPerformanceLevelCapability.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The Elastic Pool performance level capability. * diff --git a/lib/services/sqlManagement2/lib/models/elasticPoolUpdate.js b/lib/services/sqlManagement2/lib/models/elasticPoolUpdate.js index 20b92a75d3..072b9fe6f3 100644 --- a/lib/services/sqlManagement2/lib/models/elasticPoolUpdate.js +++ b/lib/services/sqlManagement2/lib/models/elasticPoolUpdate.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * An elastic pool update. * diff --git a/lib/services/sqlManagement2/lib/models/failoverGroupUpdate.js b/lib/services/sqlManagement2/lib/models/failoverGroupUpdate.js index 30c598264c..2147497cbc 100644 --- a/lib/services/sqlManagement2/lib/models/failoverGroupUpdate.js +++ b/lib/services/sqlManagement2/lib/models/failoverGroupUpdate.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * A failover group update request. * diff --git a/lib/services/sqlManagement2/lib/models/index.d.ts b/lib/services/sqlManagement2/lib/models/index.d.ts index c721069313..1af7317efb 100644 --- a/lib/services/sqlManagement2/lib/models/index.d.ts +++ b/lib/services/sqlManagement2/lib/models/index.d.ts @@ -2331,9 +2331,13 @@ export interface VulnerabilityAssessmentRecurringScansProperties { * * @member {string} storageContainerPath A blob storage container path to hold * the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). - * @member {string} storageContainerSasKey A shared access signature (SAS Key) - * that has write access to the blob container specified in - * 'storageContainerPath' parameter. + * @member {string} [storageContainerSasKey] A shared access signature (SAS + * Key) that has write access to the blob container specified in + * 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't + * specified, StorageContainerSasKey is required. + * @member {string} [storageAccountAccessKey] Specifies the identifier key of + * the vulnerability assessment storage account. If 'StorageContainerSasKey' + * isn't specified, storageAccountAccessKey is required. * @member {object} [recurringScans] The recurring scans settings * @member {boolean} [recurringScans.isEnabled] Recurring scans state. * @member {boolean} [recurringScans.emailSubscriptionAdmins] Specifies that @@ -2344,7 +2348,8 @@ export interface VulnerabilityAssessmentRecurringScansProperties { */ export interface DatabaseVulnerabilityAssessment extends ProxyResource { storageContainerPath: string; - storageContainerSasKey: string; + storageContainerSasKey?: string; + storageAccountAccessKey?: string; recurringScans?: VulnerabilityAssessmentRecurringScansProperties; } diff --git a/lib/services/sqlManagement2/lib/models/locationCapabilities.js b/lib/services/sqlManagement2/lib/models/locationCapabilities.js index 0f72b83c59..96d6d38763 100644 --- a/lib/services/sqlManagement2/lib/models/locationCapabilities.js +++ b/lib/services/sqlManagement2/lib/models/locationCapabilities.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The location capability. * diff --git a/lib/services/sqlManagement2/lib/models/managedInstanceEditionCapability.js b/lib/services/sqlManagement2/lib/models/managedInstanceEditionCapability.js index c117ce2d74..48c8301ff2 100644 --- a/lib/services/sqlManagement2/lib/models/managedInstanceEditionCapability.js +++ b/lib/services/sqlManagement2/lib/models/managedInstanceEditionCapability.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The managed server capability * diff --git a/lib/services/sqlManagement2/lib/models/managedInstanceFamilyCapability.js b/lib/services/sqlManagement2/lib/models/managedInstanceFamilyCapability.js index 1ef2e7e779..dfc52ff910 100644 --- a/lib/services/sqlManagement2/lib/models/managedInstanceFamilyCapability.js +++ b/lib/services/sqlManagement2/lib/models/managedInstanceFamilyCapability.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The managed server family capability. * diff --git a/lib/services/sqlManagement2/lib/models/managedInstanceUpdate.js b/lib/services/sqlManagement2/lib/models/managedInstanceUpdate.js index d568258c58..2390be4ff3 100644 --- a/lib/services/sqlManagement2/lib/models/managedInstanceUpdate.js +++ b/lib/services/sqlManagement2/lib/models/managedInstanceUpdate.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * An update request for an Azure SQL Database managed instance. * diff --git a/lib/services/sqlManagement2/lib/models/managedInstanceVersionCapability.js b/lib/services/sqlManagement2/lib/models/managedInstanceVersionCapability.js index 8cd7cdf2e5..154896a493 100644 --- a/lib/services/sqlManagement2/lib/models/managedInstanceVersionCapability.js +++ b/lib/services/sqlManagement2/lib/models/managedInstanceVersionCapability.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The managed instance capability * diff --git a/lib/services/sqlManagement2/lib/models/maxSizeRangeCapability.js b/lib/services/sqlManagement2/lib/models/maxSizeRangeCapability.js index b5f5a10131..37aecc9b82 100644 --- a/lib/services/sqlManagement2/lib/models/maxSizeRangeCapability.js +++ b/lib/services/sqlManagement2/lib/models/maxSizeRangeCapability.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The maximum size range capability. * diff --git a/lib/services/sqlManagement2/lib/models/metric.js b/lib/services/sqlManagement2/lib/models/metric.js index ce3c791a67..923087500d 100644 --- a/lib/services/sqlManagement2/lib/models/metric.js +++ b/lib/services/sqlManagement2/lib/models/metric.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * Database metrics. * diff --git a/lib/services/sqlManagement2/lib/models/metricDefinition.js b/lib/services/sqlManagement2/lib/models/metricDefinition.js index e4722e6b0e..e71bb4cd29 100644 --- a/lib/services/sqlManagement2/lib/models/metricDefinition.js +++ b/lib/services/sqlManagement2/lib/models/metricDefinition.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * A database metric definition. * diff --git a/lib/services/sqlManagement2/lib/models/operation.js b/lib/services/sqlManagement2/lib/models/operation.js index b97c20a2c6..8886037343 100644 --- a/lib/services/sqlManagement2/lib/models/operation.js +++ b/lib/services/sqlManagement2/lib/models/operation.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * SQL REST API operation definition. * diff --git a/lib/services/sqlManagement2/lib/models/serverVersionCapability.js b/lib/services/sqlManagement2/lib/models/serverVersionCapability.js index aa369f80bb..5fe7e5a592 100644 --- a/lib/services/sqlManagement2/lib/models/serverVersionCapability.js +++ b/lib/services/sqlManagement2/lib/models/serverVersionCapability.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The server capability * diff --git a/lib/services/sqlManagement2/lib/models/serviceObjectiveCapability.js b/lib/services/sqlManagement2/lib/models/serviceObjectiveCapability.js index 55a61cef8f..1d3ce05b55 100644 --- a/lib/services/sqlManagement2/lib/models/serviceObjectiveCapability.js +++ b/lib/services/sqlManagement2/lib/models/serviceObjectiveCapability.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The service objectives capability. * diff --git a/lib/services/sqlManagement2/lib/models/syncFullSchemaProperties.js b/lib/services/sqlManagement2/lib/models/syncFullSchemaProperties.js index f2008727bf..2a7fd7b6f5 100644 --- a/lib/services/sqlManagement2/lib/models/syncFullSchemaProperties.js +++ b/lib/services/sqlManagement2/lib/models/syncFullSchemaProperties.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * Properties of the database full schema. * diff --git a/lib/services/sqlManagement2/lib/models/syncFullSchemaTable.js b/lib/services/sqlManagement2/lib/models/syncFullSchemaTable.js index 6ff8e68fb8..514fb77a81 100644 --- a/lib/services/sqlManagement2/lib/models/syncFullSchemaTable.js +++ b/lib/services/sqlManagement2/lib/models/syncFullSchemaTable.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * Properties of the table in the database full schema. * diff --git a/lib/services/sqlManagement2/lib/models/syncGroupSchema.js b/lib/services/sqlManagement2/lib/models/syncGroupSchema.js index 1d61bb1176..90c1d38c65 100644 --- a/lib/services/sqlManagement2/lib/models/syncGroupSchema.js +++ b/lib/services/sqlManagement2/lib/models/syncGroupSchema.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * Properties of sync group schema. * diff --git a/lib/services/sqlManagement2/lib/models/syncGroupSchemaTable.js b/lib/services/sqlManagement2/lib/models/syncGroupSchemaTable.js index 261a1812cd..1a8444a95a 100644 --- a/lib/services/sqlManagement2/lib/models/syncGroupSchemaTable.js +++ b/lib/services/sqlManagement2/lib/models/syncGroupSchemaTable.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * Properties of table in sync group schema. * diff --git a/lib/services/sqlManagement2/lib/operations/databaseVulnerabilityAssessments.js b/lib/services/sqlManagement2/lib/operations/databaseVulnerabilityAssessments.js index 15e382de4e..1bbb114efc 100644 --- a/lib/services/sqlManagement2/lib/operations/databaseVulnerabilityAssessments.js +++ b/lib/services/sqlManagement2/lib/operations/databaseVulnerabilityAssessments.js @@ -187,9 +187,15 @@ function _get(resourceGroupName, serverName, databaseName, options, callback) { * path to hold the scan results (e.g. * https://myStorage.blob.core.windows.net/VaScans/). * - * @param {string} parameters.storageContainerSasKey A shared access signature - * (SAS Key) that has write access to the blob container specified in - * 'storageContainerPath' parameter. + * @param {string} [parameters.storageContainerSasKey] A shared access + * signature (SAS Key) that has write access to the blob container specified in + * 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't + * specified, StorageContainerSasKey is required. + * + * @param {string} [parameters.storageAccountAccessKey] Specifies the + * identifier key of the vulnerability assessment storage account. If + * 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is + * required. * * @param {object} [parameters.recurringScans] The recurring scans settings * @@ -644,9 +650,15 @@ class DatabaseVulnerabilityAssessments { * path to hold the scan results (e.g. * https://myStorage.blob.core.windows.net/VaScans/). * - * @param {string} parameters.storageContainerSasKey A shared access signature - * (SAS Key) that has write access to the blob container specified in - * 'storageContainerPath' parameter. + * @param {string} [parameters.storageContainerSasKey] A shared access + * signature (SAS Key) that has write access to the blob container specified in + * 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't + * specified, StorageContainerSasKey is required. + * + * @param {string} [parameters.storageAccountAccessKey] Specifies the + * identifier key of the vulnerability assessment storage account. If + * 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is + * required. * * @param {object} [parameters.recurringScans] The recurring scans settings * @@ -703,9 +715,15 @@ class DatabaseVulnerabilityAssessments { * path to hold the scan results (e.g. * https://myStorage.blob.core.windows.net/VaScans/). * - * @param {string} parameters.storageContainerSasKey A shared access signature - * (SAS Key) that has write access to the blob container specified in - * 'storageContainerPath' parameter. + * @param {string} [parameters.storageContainerSasKey] A shared access + * signature (SAS Key) that has write access to the blob container specified in + * 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't + * specified, StorageContainerSasKey is required. + * + * @param {string} [parameters.storageAccountAccessKey] Specifies the + * identifier key of the vulnerability assessment storage account. If + * 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is + * required. * * @param {object} [parameters.recurringScans] The recurring scans settings * diff --git a/lib/services/sqlManagement2/lib/operations/index.d.ts b/lib/services/sqlManagement2/lib/operations/index.d.ts index 8d9fa74aad..836f355a11 100644 --- a/lib/services/sqlManagement2/lib/operations/index.d.ts +++ b/lib/services/sqlManagement2/lib/operations/index.d.ts @@ -18612,9 +18612,15 @@ export interface DatabaseVulnerabilityAssessments { * path to hold the scan results (e.g. * https://myStorage.blob.core.windows.net/VaScans/). * - * @param {string} parameters.storageContainerSasKey A shared access signature - * (SAS Key) that has write access to the blob container specified in - * 'storageContainerPath' parameter. + * @param {string} [parameters.storageContainerSasKey] A shared access + * signature (SAS Key) that has write access to the blob container specified in + * 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't + * specified, StorageContainerSasKey is required. + * + * @param {string} [parameters.storageAccountAccessKey] Specifies the + * identifier key of the vulnerability assessment storage account. If + * 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is + * required. * * @param {object} [parameters.recurringScans] The recurring scans settings * @@ -18659,9 +18665,15 @@ export interface DatabaseVulnerabilityAssessments { * path to hold the scan results (e.g. * https://myStorage.blob.core.windows.net/VaScans/). * - * @param {string} parameters.storageContainerSasKey A shared access signature - * (SAS Key) that has write access to the blob container specified in - * 'storageContainerPath' parameter. + * @param {string} [parameters.storageContainerSasKey] A shared access + * signature (SAS Key) that has write access to the blob container specified in + * 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't + * specified, StorageContainerSasKey is required. + * + * @param {string} [parameters.storageAccountAccessKey] Specifies the + * identifier key of the vulnerability assessment storage account. If + * 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is + * required. * * @param {object} [parameters.recurringScans] The recurring scans settings * @@ -25084,6 +25096,88 @@ export interface SensitivityLabels { listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + /** + * Gets the sensitivity labels of a given database + * + * @param {string} resourceGroupName The name of the resource group that + * contains the resource. You can obtain this value from the Azure Resource + * Manager API or the portal. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {string} sensitivityLabelSource Optional source of the sensitivity + * label. Valid values are current or recommeneded. In not specified both + * returned. Possible values include: 'current', 'recommended' + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] An OData filter expression that filters + * elements in the collection. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByDatabaseWithSourceWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, sensitivityLabelSource: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the sensitivity labels of a given database + * + * @param {string} resourceGroupName The name of the resource group that + * contains the resource. You can obtain this value from the Azure Resource + * Manager API or the portal. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {string} sensitivityLabelSource Optional source of the sensitivity + * label. Valid values are current or recommeneded. In not specified both + * returned. Possible values include: 'current', 'recommended' + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] An OData filter expression that filters + * elements in the collection. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {SensitivityLabelListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {SensitivityLabelListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SensitivityLabelListResult} 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. + */ + listByDatabaseWithSource(resourceGroupName: string, serverName: string, databaseName: string, sensitivityLabelSource: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByDatabaseWithSource(resourceGroupName: string, serverName: string, databaseName: string, sensitivityLabelSource: string, callback: ServiceCallback): void; + listByDatabaseWithSource(resourceGroupName: string, serverName: string, databaseName: string, sensitivityLabelSource: string, options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + /** * Gets the sensitivity label of a given column * @@ -25394,6 +25488,64 @@ export interface SensitivityLabels { listByDatabaseNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; listByDatabaseNext(nextPageLink: string, callback: ServiceCallback): void; listByDatabaseNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the sensitivity labels of a given database + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByDatabaseWithSourceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the sensitivity labels of a given database + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {SensitivityLabelListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {SensitivityLabelListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SensitivityLabelListResult} 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. + */ + listByDatabaseWithSourceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByDatabaseWithSourceNext(nextPageLink: string, callback: ServiceCallback): void; + listByDatabaseWithSourceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** diff --git a/lib/services/sqlManagement2/lib/operations/sensitivityLabels.js b/lib/services/sqlManagement2/lib/operations/sensitivityLabels.js index 0d14175b2e..c78e01e640 100644 --- a/lib/services/sqlManagement2/lib/operations/sensitivityLabels.js +++ b/lib/services/sqlManagement2/lib/operations/sensitivityLabels.js @@ -176,6 +176,181 @@ function _listByDatabase(resourceGroupName, serverName, databaseName, options, c }); } +/** + * Gets the sensitivity labels of a given database + * + * @param {string} resourceGroupName The name of the resource group that + * contains the resource. You can obtain this value from the Azure Resource + * Manager API or the portal. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {string} sensitivityLabelSource Optional source of the sensitivity + * label. Valid values are current or recommeneded. In not specified both + * returned. Possible values include: 'current', 'recommended' + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] An OData filter expression that filters + * elements in the collection. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link SensitivityLabelListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByDatabaseWithSource(resourceGroupName, serverName, databaseName, sensitivityLabelSource, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let apiVersion = '2017-03-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (serverName === null || serverName === undefined || typeof serverName.valueOf() !== 'string') { + throw new Error('serverName cannot be null or undefined and it must be of type string.'); + } + if (databaseName === null || databaseName === undefined || typeof databaseName.valueOf() !== 'string') { + throw new Error('databaseName cannot be null or undefined and it must be of type string.'); + } + if (sensitivityLabelSource) { + let allowedValues = [ 'current', 'recommended' ]; + if (!allowedValues.some( function(item) { return item === sensitivityLabelSource; })) { + throw new Error(sensitivityLabelSource + ' is not a valid value. The valid values are: ' + allowedValues); + } + } else { + throw new Error('sensitivityLabelSource cannot be null or undefined.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/sensitivityLabels/{sensitivityLabelSource}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); + requestUrl = requestUrl.replace('{databaseName}', encodeURIComponent(databaseName)); + requestUrl = requestUrl.replace('{sensitivityLabelSource}', encodeURIComponent(sensitivityLabelSource)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['SensitivityLabelListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + /** * Gets the sensitivity label of a given column * @@ -849,6 +1024,134 @@ function _listByDatabaseNext(nextPageLink, options, callback) { }); } +/** + * Gets the sensitivity labels of a given database + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link SensitivityLabelListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByDatabaseWithSourceNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['SensitivityLabelListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + /** Class representing a SensitivityLabels. */ class SensitivityLabels { /** @@ -858,10 +1161,12 @@ class SensitivityLabels { constructor(client) { this.client = client; this._listByDatabase = _listByDatabase; + this._listByDatabaseWithSource = _listByDatabaseWithSource; this._get = _get; this._createOrUpdate = _createOrUpdate; this._deleteMethod = _deleteMethod; this._listByDatabaseNext = _listByDatabaseNext; + this._listByDatabaseWithSourceNext = _listByDatabaseWithSourceNext; } /** @@ -965,6 +1270,115 @@ class SensitivityLabels { } } + /** + * Gets the sensitivity labels of a given database + * + * @param {string} resourceGroupName The name of the resource group that + * contains the resource. You can obtain this value from the Azure Resource + * Manager API or the portal. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {string} sensitivityLabelSource Optional source of the sensitivity + * label. Valid values are current or recommeneded. In not specified both + * returned. Possible values include: 'current', 'recommended' + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] An OData filter expression that filters + * elements in the collection. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByDatabaseWithSourceWithHttpOperationResponse(resourceGroupName, serverName, databaseName, sensitivityLabelSource, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByDatabaseWithSource(resourceGroupName, serverName, databaseName, sensitivityLabelSource, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the sensitivity labels of a given database + * + * @param {string} resourceGroupName The name of the resource group that + * contains the resource. You can obtain this value from the Azure Resource + * Manager API or the portal. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {string} sensitivityLabelSource Optional source of the sensitivity + * label. Valid values are current or recommeneded. In not specified both + * returned. Possible values include: 'current', 'recommended' + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] An OData filter expression that filters + * elements in the collection. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {SensitivityLabelListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link SensitivityLabelListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByDatabaseWithSource(resourceGroupName, serverName, databaseName, sensitivityLabelSource, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByDatabaseWithSource(resourceGroupName, serverName, databaseName, sensitivityLabelSource, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByDatabaseWithSource(resourceGroupName, serverName, databaseName, sensitivityLabelSource, options, optionalCallback); + } + } + /** * Gets the sensitivity label of a given column * @@ -1385,6 +1799,91 @@ class SensitivityLabels { } } + /** + * Gets the sensitivity labels of a given database + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByDatabaseWithSourceNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByDatabaseWithSourceNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the sensitivity labels of a given database + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {SensitivityLabelListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link SensitivityLabelListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByDatabaseWithSourceNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByDatabaseWithSourceNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByDatabaseWithSourceNext(nextPageLink, options, optionalCallback); + } + } + } module.exports = SensitivityLabels; diff --git a/lib/services/sqlManagement2/package-lock.json b/lib/services/sqlManagement2/package-lock.json index 75161b60de..bfde661dab 100644 --- a/lib/services/sqlManagement2/package-lock.json +++ b/lib/services/sqlManagement2/package-lock.json @@ -1,6 +1,6 @@ { "name": "azure-arm-sql", - "version": "4.1.0", + "version": "4.2.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/lib/services/sqlManagement2/package.json b/lib/services/sqlManagement2/package.json index 2268a9ee59..1087db0c46 100644 --- a/lib/services/sqlManagement2/package.json +++ b/lib/services/sqlManagement2/package.json @@ -2,7 +2,7 @@ "name": "azure-arm-sql", "author": "Microsoft Corporation", "description": "SqlManagementClient Library with typescript type definitions for node", - "version": "4.1.0", + "version": "4.2.0", "dependencies": { "ms-rest": "^2.3.3", "ms-rest-azure": "^2.5.5" @@ -14,7 +14,7 @@ "license": "MIT", "main": "./lib/sqlManagementClient.js", "types": "./lib/sqlManagementClient.d.ts", - "homepage": "https://github.com/azure/azure-sdk-for-node/lib/services/sqlManagement2", + "homepage": "https://github.com/azure/azure-sdk-for-node/tree/master/lib/services/sqlManagement2", "repository": { "type": "git", "url": "https://github.com/azure/azure-sdk-for-node.git"