From 8b74cff03189a0cfdc67d9247ee058ce067e5b57 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Sun, 20 Jan 2019 10:46:14 +0000 Subject: [PATCH 1/2] Generated from d4e6f4b5b04154faca5593d376ba00579177bed1 Revert "Added missing description change" This reverts commit 17aeab7011d6085d08e562248eb89c2b2fe40277. --- .../sqlManagement2/lib/models/index.d.ts | 45 +- .../sqlManagement2/lib/models/index.js | 3 + ...icalServerSecurityAlertPolicyListResult.js | 69 +++ .../managedDatabaseSecurityAlertPolicy.js | 3 +- ...edDatabaseSecurityAlertPolicyListResult.js | 69 +++ .../managedServerSecurityAlertPolicy.js | 3 +- ...agedServerSecurityAlertPolicyListResult.js | 69 +++ .../lib/models/serverSecurityAlertPolicy.js | 3 +- .../sqlManagement2/lib/operations/index.d.ts | 414 ++++++++++++++- .../managedDatabaseSecurityAlertPolicies.js | 481 +++++++++++++++++- .../managedServerSecurityAlertPolicies.js | 476 ++++++++++++++++- .../operations/serverSecurityAlertPolicies.js | 476 ++++++++++++++++- 12 files changed, 2055 insertions(+), 56 deletions(-) create mode 100644 lib/services/sqlManagement2/lib/models/logicalServerSecurityAlertPolicyListResult.js create mode 100644 lib/services/sqlManagement2/lib/models/managedDatabaseSecurityAlertPolicyListResult.js create mode 100644 lib/services/sqlManagement2/lib/models/managedServerSecurityAlertPolicyListResult.js diff --git a/lib/services/sqlManagement2/lib/models/index.d.ts b/lib/services/sqlManagement2/lib/models/index.d.ts index 80d68d6b47..6ce2d8493b 100644 --- a/lib/services/sqlManagement2/lib/models/index.d.ts +++ b/lib/services/sqlManagement2/lib/models/index.d.ts @@ -3089,7 +3089,8 @@ export interface ServerDnsAliasAcquisition { * A server security alert policy. * * @property {string} state Specifies the state of the policy, whether it is - * enabled or disabled. Possible values include: 'New', 'Enabled', 'Disabled' + * enabled or disabled or a policy has not been applied yet on the specific + * resource. Possible values include: 'New', 'Enabled', 'Disabled' * @property {array} [disabledAlerts] Specifies an array of alerts that are * disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, * Access_Anomaly, Data_Exfiltration, Unsafe_Action @@ -3182,7 +3183,8 @@ export interface CreateDatabaseRestorePointDefinition { * A managed database security alert policy. * * @property {string} state Specifies the state of the policy, whether it is - * enabled or disabled. Possible values include: 'New', 'Enabled', 'Disabled' + * enabled or disabled or a policy has not been applied yet on the specific + * resource. Possible values include: 'New', 'Enabled', 'Disabled' * @property {array} [disabledAlerts] Specifies an array of alerts that are * disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, * Access_Anomaly, Data_Exfiltration, Unsafe_Action @@ -3218,7 +3220,8 @@ export interface ManagedDatabaseSecurityAlertPolicy extends ProxyResource { * A managed server security alert policy. * * @property {string} state Specifies the state of the policy, whether it is - * enabled or disabled. Possible values include: 'New', 'Enabled', 'Disabled' + * enabled or disabled or a policy has not been applied yet on the specific + * resource. Possible values include: 'New', 'Enabled', 'Disabled' * @property {array} [disabledAlerts] Specifies an array of alerts that are * disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, * Access_Anomaly, Data_Exfiltration, Unsafe_Action @@ -5058,6 +5061,18 @@ export interface ServerDnsAliasListResult extends Array { readonly nextLink?: string; } +/** + * @class + * Initializes a new instance of the LogicalServerSecurityAlertPolicyListResult class. + * @constructor + * A list of the server's security alert policies. + * + * @property {string} [nextLink] Link to retrieve next page of results. + */ +export interface LogicalServerSecurityAlertPolicyListResult extends Array { + readonly nextLink?: string; +} + /** * @class * Initializes a new instance of the RestorableDroppedManagedDatabaseListResult class. @@ -5082,6 +5097,30 @@ export interface RestorePointListResult extends Array { readonly nextLink?: string; } +/** + * @class + * Initializes a new instance of the ManagedDatabaseSecurityAlertPolicyListResult class. + * @constructor + * A list of the managed database's security alert policies. + * + * @property {string} [nextLink] Link to retrieve next page of results. + */ +export interface ManagedDatabaseSecurityAlertPolicyListResult extends Array { + readonly nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ManagedServerSecurityAlertPolicyListResult class. + * @constructor + * A list of the managed Server's security alert policies. + * + * @property {string} [nextLink] Link to retrieve next page of results. + */ +export interface ManagedServerSecurityAlertPolicyListResult extends Array { + readonly nextLink?: string; +} + /** * @class * Initializes a new instance of the DatabaseOperationListResult class. diff --git a/lib/services/sqlManagement2/lib/models/index.js b/lib/services/sqlManagement2/lib/models/index.js index a207279880..bb6b40814e 100644 --- a/lib/services/sqlManagement2/lib/models/index.js +++ b/lib/services/sqlManagement2/lib/models/index.js @@ -213,8 +213,11 @@ exports.LongTermRetentionBackupListResult = require('./longTermRetentionBackupLi exports.ManagedBackupShortTermRetentionPolicyListResult = require('./managedBackupShortTermRetentionPolicyListResult'); exports.ManagedDatabaseListResult = require('./managedDatabaseListResult'); exports.ServerDnsAliasListResult = require('./serverDnsAliasListResult'); +exports.LogicalServerSecurityAlertPolicyListResult = require('./logicalServerSecurityAlertPolicyListResult'); exports.RestorableDroppedManagedDatabaseListResult = require('./restorableDroppedManagedDatabaseListResult'); exports.RestorePointListResult = require('./restorePointListResult'); +exports.ManagedDatabaseSecurityAlertPolicyListResult = require('./managedDatabaseSecurityAlertPolicyListResult'); +exports.ManagedServerSecurityAlertPolicyListResult = require('./managedServerSecurityAlertPolicyListResult'); exports.DatabaseOperationListResult = require('./databaseOperationListResult'); exports.ElasticPoolOperationListResult = require('./elasticPoolOperationListResult'); exports.VulnerabilityAssessmentScanRecordListResult = require('./vulnerabilityAssessmentScanRecordListResult'); diff --git a/lib/services/sqlManagement2/lib/models/logicalServerSecurityAlertPolicyListResult.js b/lib/services/sqlManagement2/lib/models/logicalServerSecurityAlertPolicyListResult.js new file mode 100644 index 0000000000..8e754a7da6 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/logicalServerSecurityAlertPolicyListResult.js @@ -0,0 +1,69 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * A list of the server's security alert policies. + */ +class LogicalServerSecurityAlertPolicyListResult extends Array { + /** + * Create a LogicalServerSecurityAlertPolicyListResult. + * @property {string} [nextLink] Link to retrieve next page of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of LogicalServerSecurityAlertPolicyListResult + * + * @returns {object} metadata of LogicalServerSecurityAlertPolicyListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'LogicalServerSecurityAlertPolicyListResult', + type: { + name: 'Composite', + className: 'LogicalServerSecurityAlertPolicyListResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ServerSecurityAlertPolicyElementType', + type: { + name: 'Composite', + className: 'ServerSecurityAlertPolicy' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = LogicalServerSecurityAlertPolicyListResult; diff --git a/lib/services/sqlManagement2/lib/models/managedDatabaseSecurityAlertPolicy.js b/lib/services/sqlManagement2/lib/models/managedDatabaseSecurityAlertPolicy.js index 6fa7d5c76c..a593f82d20 100644 --- a/lib/services/sqlManagement2/lib/models/managedDatabaseSecurityAlertPolicy.js +++ b/lib/services/sqlManagement2/lib/models/managedDatabaseSecurityAlertPolicy.js @@ -21,7 +21,8 @@ class ManagedDatabaseSecurityAlertPolicy extends models['ProxyResource'] { /** * Create a ManagedDatabaseSecurityAlertPolicy. * @property {string} state Specifies the state of the policy, whether it is - * enabled or disabled. Possible values include: 'New', 'Enabled', 'Disabled' + * enabled or disabled or a policy has not been applied yet on the specific + * resource. Possible values include: 'New', 'Enabled', 'Disabled' * @property {array} [disabledAlerts] Specifies an array of alerts that are * disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, * Access_Anomaly, Data_Exfiltration, Unsafe_Action diff --git a/lib/services/sqlManagement2/lib/models/managedDatabaseSecurityAlertPolicyListResult.js b/lib/services/sqlManagement2/lib/models/managedDatabaseSecurityAlertPolicyListResult.js new file mode 100644 index 0000000000..325e32d90c --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/managedDatabaseSecurityAlertPolicyListResult.js @@ -0,0 +1,69 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * A list of the managed database's security alert policies. + */ +class ManagedDatabaseSecurityAlertPolicyListResult extends Array { + /** + * Create a ManagedDatabaseSecurityAlertPolicyListResult. + * @property {string} [nextLink] Link to retrieve next page of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ManagedDatabaseSecurityAlertPolicyListResult + * + * @returns {object} metadata of ManagedDatabaseSecurityAlertPolicyListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ManagedDatabaseSecurityAlertPolicyListResult', + type: { + name: 'Composite', + className: 'ManagedDatabaseSecurityAlertPolicyListResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ManagedDatabaseSecurityAlertPolicyElementType', + type: { + name: 'Composite', + className: 'ManagedDatabaseSecurityAlertPolicy' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ManagedDatabaseSecurityAlertPolicyListResult; diff --git a/lib/services/sqlManagement2/lib/models/managedServerSecurityAlertPolicy.js b/lib/services/sqlManagement2/lib/models/managedServerSecurityAlertPolicy.js index 01c5530828..0b2f19bc6b 100644 --- a/lib/services/sqlManagement2/lib/models/managedServerSecurityAlertPolicy.js +++ b/lib/services/sqlManagement2/lib/models/managedServerSecurityAlertPolicy.js @@ -21,7 +21,8 @@ class ManagedServerSecurityAlertPolicy extends models['ProxyResource'] { /** * Create a ManagedServerSecurityAlertPolicy. * @property {string} state Specifies the state of the policy, whether it is - * enabled or disabled. Possible values include: 'New', 'Enabled', 'Disabled' + * enabled or disabled or a policy has not been applied yet on the specific + * resource. Possible values include: 'New', 'Enabled', 'Disabled' * @property {array} [disabledAlerts] Specifies an array of alerts that are * disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, * Access_Anomaly, Data_Exfiltration, Unsafe_Action diff --git a/lib/services/sqlManagement2/lib/models/managedServerSecurityAlertPolicyListResult.js b/lib/services/sqlManagement2/lib/models/managedServerSecurityAlertPolicyListResult.js new file mode 100644 index 0000000000..33501deb5c --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/managedServerSecurityAlertPolicyListResult.js @@ -0,0 +1,69 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * A list of the managed Server's security alert policies. + */ +class ManagedServerSecurityAlertPolicyListResult extends Array { + /** + * Create a ManagedServerSecurityAlertPolicyListResult. + * @property {string} [nextLink] Link to retrieve next page of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ManagedServerSecurityAlertPolicyListResult + * + * @returns {object} metadata of ManagedServerSecurityAlertPolicyListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ManagedServerSecurityAlertPolicyListResult', + type: { + name: 'Composite', + className: 'ManagedServerSecurityAlertPolicyListResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ManagedServerSecurityAlertPolicyElementType', + type: { + name: 'Composite', + className: 'ManagedServerSecurityAlertPolicy' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ManagedServerSecurityAlertPolicyListResult; diff --git a/lib/services/sqlManagement2/lib/models/serverSecurityAlertPolicy.js b/lib/services/sqlManagement2/lib/models/serverSecurityAlertPolicy.js index 0ce89477be..499ea9a6b5 100644 --- a/lib/services/sqlManagement2/lib/models/serverSecurityAlertPolicy.js +++ b/lib/services/sqlManagement2/lib/models/serverSecurityAlertPolicy.js @@ -21,7 +21,8 @@ class ServerSecurityAlertPolicy extends models['ProxyResource'] { /** * Create a ServerSecurityAlertPolicy. * @property {string} state Specifies the state of the policy, whether it is - * enabled or disabled. Possible values include: 'New', 'Enabled', 'Disabled' + * enabled or disabled or a policy has not been applied yet on the specific + * resource. Possible values include: 'New', 'Enabled', 'Disabled' * @property {array} [disabledAlerts] Specifies an array of alerts that are * disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, * Access_Anomaly, Data_Exfiltration, Unsafe_Action diff --git a/lib/services/sqlManagement2/lib/operations/index.d.ts b/lib/services/sqlManagement2/lib/operations/index.d.ts index d8b64f115f..243d7f05d5 100644 --- a/lib/services/sqlManagement2/lib/operations/index.d.ts +++ b/lib/services/sqlManagement2/lib/operations/index.d.ts @@ -27417,8 +27417,8 @@ export interface ServerSecurityAlertPolicies { * @param {object} parameters The server security alert policy. * * @param {string} parameters.state Specifies the state of the policy, whether - * it is enabled or disabled. Possible values include: 'New', 'Enabled', - * 'Disabled' + * it is enabled or disabled or a policy has not been applied yet on the + * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -27466,8 +27466,8 @@ export interface ServerSecurityAlertPolicies { * @param {object} parameters The server security alert policy. * * @param {string} parameters.state Specifies the state of the policy, whether - * it is enabled or disabled. Possible values include: 'New', 'Enabled', - * 'Disabled' + * it is enabled or disabled or a policy has not been applied yet on the + * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -27523,6 +27523,70 @@ export interface ServerSecurityAlertPolicies { createOrUpdate(resourceGroupName: string, serverName: string, parameters: models.ServerSecurityAlertPolicy, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + /** + * Get the server's threat detection policies. + * + * @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 {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByServerWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get the server's threat detection policies. + * + * @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 {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {LogicalServerSecurityAlertPolicyListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {LogicalServerSecurityAlertPolicyListResult} [result] - The deserialized result object if an error did not occur. + * See {@link LogicalServerSecurityAlertPolicyListResult} + * 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. + */ + listByServer(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServer(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; + listByServer(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + /** * Creates or updates a threat detection policy. * @@ -27535,8 +27599,8 @@ export interface ServerSecurityAlertPolicies { * @param {object} parameters The server security alert policy. * * @param {string} parameters.state Specifies the state of the policy, whether - * it is enabled or disabled. Possible values include: 'New', 'Enabled', - * 'Disabled' + * it is enabled or disabled or a policy has not been applied yet on the + * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -27584,8 +27648,8 @@ export interface ServerSecurityAlertPolicies { * @param {object} parameters The server security alert policy. * * @param {string} parameters.state Specifies the state of the policy, whether - * it is enabled or disabled. Possible values include: 'New', 'Enabled', - * 'Disabled' + * it is enabled or disabled or a policy has not been applied yet on the + * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -27639,6 +27703,64 @@ export interface ServerSecurityAlertPolicies { beginCreateOrUpdate(resourceGroupName: string, serverName: string, parameters: models.ServerSecurityAlertPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; beginCreateOrUpdate(resourceGroupName: string, serverName: string, parameters: models.ServerSecurityAlertPolicy, callback: ServiceCallback): void; beginCreateOrUpdate(resourceGroupName: string, serverName: string, parameters: models.ServerSecurityAlertPolicy, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get the server's threat detection policies. + * + * @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. + */ + listByServerNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get the server's threat detection policies. + * + * @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 {LogicalServerSecurityAlertPolicyListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {LogicalServerSecurityAlertPolicyListResult} [result] - The deserialized result object if an error did not occur. + * See {@link LogicalServerSecurityAlertPolicyListResult} + * 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. + */ + listByServerNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServerNext(nextPageLink: string, callback: ServiceCallback): void; + listByServerNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** @@ -28310,8 +28432,8 @@ export interface ManagedDatabaseSecurityAlertPolicies { * @param {object} parameters The database security alert policy. * * @param {string} parameters.state Specifies the state of the policy, whether - * it is enabled or disabled. Possible values include: 'New', 'Enabled', - * 'Disabled' + * it is enabled or disabled or a policy has not been applied yet on the + * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -28362,8 +28484,8 @@ export interface ManagedDatabaseSecurityAlertPolicies { * @param {object} parameters The database security alert policy. * * @param {string} parameters.state Specifies the state of the policy, whether - * it is enabled or disabled. Possible values include: 'New', 'Enabled', - * 'Disabled' + * it is enabled or disabled or a policy has not been applied yet on the + * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -28417,6 +28539,136 @@ export interface ManagedDatabaseSecurityAlertPolicies { createOrUpdate(resourceGroupName: string, managedInstanceName: string, databaseName: string, parameters: models.ManagedDatabaseSecurityAlertPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; createOrUpdate(resourceGroupName: string, managedInstanceName: string, databaseName: string, parameters: models.ManagedDatabaseSecurityAlertPolicy, callback: ServiceCallback): void; createOrUpdate(resourceGroupName: string, managedInstanceName: string, databaseName: string, parameters: models.ManagedDatabaseSecurityAlertPolicy, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets a list of managed database's security alert policies. + * + * @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} managedInstanceName The name of the managed instance. + * + * @param {string} databaseName The name of the managed database for which the + * security alert policies are defined. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByDatabaseWithHttpOperationResponse(resourceGroupName: string, managedInstanceName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a list of managed database's security alert policies. + * + * @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} managedInstanceName The name of the managed instance. + * + * @param {string} databaseName The name of the managed database for which the + * security alert policies are defined. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ManagedDatabaseSecurityAlertPolicyListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ManagedDatabaseSecurityAlertPolicyListResult} [result] - The deserialized result object if an error did not occur. + * See {@link + * ManagedDatabaseSecurityAlertPolicyListResult} 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. + */ + listByDatabase(resourceGroupName: string, managedInstanceName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByDatabase(resourceGroupName: string, managedInstanceName: string, databaseName: string, callback: ServiceCallback): void; + listByDatabase(resourceGroupName: string, managedInstanceName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets a list of managed database's security alert policies. + * + * @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. + */ + listByDatabaseNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a list of managed database's security alert policies. + * + * @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 {ManagedDatabaseSecurityAlertPolicyListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ManagedDatabaseSecurityAlertPolicyListResult} [result] - The deserialized result object if an error did not occur. + * See {@link + * ManagedDatabaseSecurityAlertPolicyListResult} 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. + */ + 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; } /** @@ -28504,8 +28756,8 @@ export interface ManagedServerSecurityAlertPolicies { * @param {object} parameters The managed server security alert policy. * * @param {string} parameters.state Specifies the state of the policy, whether - * it is enabled or disabled. Possible values include: 'New', 'Enabled', - * 'Disabled' + * it is enabled or disabled or a policy has not been applied yet on the + * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -28553,8 +28805,8 @@ export interface ManagedServerSecurityAlertPolicies { * @param {object} parameters The managed server security alert policy. * * @param {string} parameters.state Specifies the state of the policy, whether - * it is enabled or disabled. Possible values include: 'New', 'Enabled', - * 'Disabled' + * it is enabled or disabled or a policy has not been applied yet on the + * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -28610,6 +28862,70 @@ export interface ManagedServerSecurityAlertPolicies { createOrUpdate(resourceGroupName: string, managedInstanceName: string, parameters: models.ManagedServerSecurityAlertPolicy, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + /** + * Get the managed server's threat detection policies. + * + * @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} managedInstanceName The name of the managed instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByInstanceWithHttpOperationResponse(resourceGroupName: string, managedInstanceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get the managed server's threat detection policies. + * + * @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} managedInstanceName The name of the managed instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ManagedServerSecurityAlertPolicyListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ManagedServerSecurityAlertPolicyListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedServerSecurityAlertPolicyListResult} + * 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. + */ + listByInstance(resourceGroupName: string, managedInstanceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByInstance(resourceGroupName: string, managedInstanceName: string, callback: ServiceCallback): void; + listByInstance(resourceGroupName: string, managedInstanceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + /** * Creates or updates a threat detection policy. * @@ -28622,8 +28938,8 @@ export interface ManagedServerSecurityAlertPolicies { * @param {object} parameters The managed server security alert policy. * * @param {string} parameters.state Specifies the state of the policy, whether - * it is enabled or disabled. Possible values include: 'New', 'Enabled', - * 'Disabled' + * it is enabled or disabled or a policy has not been applied yet on the + * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -28671,8 +28987,8 @@ export interface ManagedServerSecurityAlertPolicies { * @param {object} parameters The managed server security alert policy. * * @param {string} parameters.state Specifies the state of the policy, whether - * it is enabled or disabled. Possible values include: 'New', 'Enabled', - * 'Disabled' + * it is enabled or disabled or a policy has not been applied yet on the + * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -28726,6 +29042,64 @@ export interface ManagedServerSecurityAlertPolicies { beginCreateOrUpdate(resourceGroupName: string, managedInstanceName: string, parameters: models.ManagedServerSecurityAlertPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; beginCreateOrUpdate(resourceGroupName: string, managedInstanceName: string, parameters: models.ManagedServerSecurityAlertPolicy, callback: ServiceCallback): void; beginCreateOrUpdate(resourceGroupName: string, managedInstanceName: string, parameters: models.ManagedServerSecurityAlertPolicy, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get the managed server's threat detection policies. + * + * @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. + */ + listByInstanceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get the managed server's threat detection policies. + * + * @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 {ManagedServerSecurityAlertPolicyListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ManagedServerSecurityAlertPolicyListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedServerSecurityAlertPolicyListResult} + * 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. + */ + listByInstanceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByInstanceNext(nextPageLink: string, callback: ServiceCallback): void; + listByInstanceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** diff --git a/lib/services/sqlManagement2/lib/operations/managedDatabaseSecurityAlertPolicies.js b/lib/services/sqlManagement2/lib/operations/managedDatabaseSecurityAlertPolicies.js index 6a724ed76f..d51aa844e0 100644 --- a/lib/services/sqlManagement2/lib/operations/managedDatabaseSecurityAlertPolicies.js +++ b/lib/services/sqlManagement2/lib/operations/managedDatabaseSecurityAlertPolicies.js @@ -184,8 +184,8 @@ function _get(resourceGroupName, managedInstanceName, databaseName, options, cal * @param {object} parameters The database security alert policy. * * @param {string} parameters.state Specifies the state of the policy, whether - * it is enabled or disabled. Possible values include: 'New', 'Enabled', - * 'Disabled' + * it is enabled or disabled or a policy has not been applied yet on the + * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -385,6 +385,289 @@ function _createOrUpdate(resourceGroupName, managedInstanceName, databaseName, p }); } +/** + * Gets a list of managed database's security alert policies. + * + * @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} managedInstanceName The name of the managed instance. + * + * @param {string} databaseName The name of the managed database for which the + * security alert policies are defined. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * 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 + * ManagedDatabaseSecurityAlertPolicyListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByDatabase(resourceGroupName, managedInstanceName, databaseName, options, callback) { + /* jshint 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 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 (managedInstanceName === null || managedInstanceName === undefined || typeof managedInstanceName.valueOf() !== 'string') { + throw new Error('managedInstanceName 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 (this.client.subscriptionId === null || this.client.subscriptionId === undefined || 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/managedInstances/{managedInstanceName}/databases/{databaseName}/securityAlertPolicies'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{managedInstanceName}', encodeURIComponent(managedInstanceName)); + requestUrl = requestUrl.replace('{databaseName}', encodeURIComponent(databaseName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + 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['ManagedDatabaseSecurityAlertPolicyListResult']().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 a list of managed database's security alert policies. + * + * @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 + * ManagedDatabaseSecurityAlertPolicyListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByDatabaseNext(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['ManagedDatabaseSecurityAlertPolicyListResult']().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 ManagedDatabaseSecurityAlertPolicies. */ class ManagedDatabaseSecurityAlertPolicies { /** @@ -395,6 +678,8 @@ class ManagedDatabaseSecurityAlertPolicies { this.client = client; this._get = _get; this._createOrUpdate = _createOrUpdate; + this._listByDatabase = _listByDatabase; + this._listByDatabaseNext = _listByDatabaseNext; } /** @@ -509,8 +794,8 @@ class ManagedDatabaseSecurityAlertPolicies { * @param {object} parameters The database security alert policy. * * @param {string} parameters.state Specifies the state of the policy, whether - * it is enabled or disabled. Possible values include: 'New', 'Enabled', - * 'Disabled' + * it is enabled or disabled or a policy has not been applied yet on the + * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -573,8 +858,8 @@ class ManagedDatabaseSecurityAlertPolicies { * @param {object} parameters The database security alert policy. * * @param {string} parameters.state Specifies the state of the policy, whether - * it is enabled or disabled. Possible values include: 'New', 'Enabled', - * 'Disabled' + * it is enabled or disabled or a policy has not been applied yet on the + * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -645,6 +930,190 @@ class ManagedDatabaseSecurityAlertPolicies { } } + /** + * Gets a list of managed database's security alert policies. + * + * @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} managedInstanceName The name of the managed instance. + * + * @param {string} databaseName The name of the managed database for which the + * security alert policies are defined. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByDatabaseWithHttpOperationResponse(resourceGroupName, managedInstanceName, databaseName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByDatabase(resourceGroupName, managedInstanceName, databaseName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a list of managed database's security alert policies. + * + * @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} managedInstanceName The name of the managed instance. + * + * @param {string} databaseName The name of the managed database for which the + * security alert policies are defined. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ManagedDatabaseSecurityAlertPolicyListResult} - The deserialized 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 + * ManagedDatabaseSecurityAlertPolicyListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByDatabase(resourceGroupName, managedInstanceName, databaseName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByDatabase(resourceGroupName, managedInstanceName, databaseName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByDatabase(resourceGroupName, managedInstanceName, databaseName, options, optionalCallback); + } + } + + /** + * Gets a list of managed database's security alert policies. + * + * @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. + */ + listByDatabaseNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByDatabaseNext(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 a list of managed database's security alert policies. + * + * @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 {ManagedDatabaseSecurityAlertPolicyListResult} - The deserialized 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 + * ManagedDatabaseSecurityAlertPolicyListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByDatabaseNext(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._listByDatabaseNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByDatabaseNext(nextPageLink, options, optionalCallback); + } + } + } module.exports = ManagedDatabaseSecurityAlertPolicies; diff --git a/lib/services/sqlManagement2/lib/operations/managedServerSecurityAlertPolicies.js b/lib/services/sqlManagement2/lib/operations/managedServerSecurityAlertPolicies.js index fce20d5552..a0245bfcc8 100644 --- a/lib/services/sqlManagement2/lib/operations/managedServerSecurityAlertPolicies.js +++ b/lib/services/sqlManagement2/lib/operations/managedServerSecurityAlertPolicies.js @@ -175,8 +175,8 @@ function _get(resourceGroupName, managedInstanceName, options, callback) { * @param {object} parameters The managed server security alert policy. * * @param {string} parameters.state Specifies the state of the policy, whether - * it is enabled or disabled. Possible values include: 'New', 'Enabled', - * 'Disabled' + * it is enabled or disabled or a policy has not been applied yet on the + * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -270,6 +270,152 @@ function _createOrUpdate(resourceGroupName, managedInstanceName, parameters, opt }); } +/** + * Get the managed server's threat detection policies. + * + * @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} managedInstanceName The name of the managed instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * 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 ManagedServerSecurityAlertPolicyListResult} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByInstance(resourceGroupName, managedInstanceName, options, callback) { + /* jshint 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 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 (managedInstanceName === null || managedInstanceName === undefined || typeof managedInstanceName.valueOf() !== 'string') { + throw new Error('managedInstanceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/securityAlertPolicies'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{managedInstanceName}', encodeURIComponent(managedInstanceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + 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['ManagedServerSecurityAlertPolicyListResult']().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); + }); +} + /** * Creates or updates a threat detection policy. * @@ -282,8 +428,8 @@ function _createOrUpdate(resourceGroupName, managedInstanceName, parameters, opt * @param {object} parameters The managed server security alert policy. * * @param {string} parameters.state Specifies the state of the policy, whether - * it is enabled or disabled. Possible values include: 'New', 'Enabled', - * 'Disabled' + * it is enabled or disabled or a policy has not been applied yet on the + * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -462,6 +608,134 @@ function _beginCreateOrUpdate(resourceGroupName, managedInstanceName, parameters }); } +/** + * Get the managed server's threat detection policies. + * + * @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 ManagedServerSecurityAlertPolicyListResult} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByInstanceNext(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['ManagedServerSecurityAlertPolicyListResult']().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 ManagedServerSecurityAlertPolicies. */ class ManagedServerSecurityAlertPolicies { /** @@ -472,7 +746,9 @@ class ManagedServerSecurityAlertPolicies { this.client = client; this._get = _get; this._createOrUpdate = _createOrUpdate; + this._listByInstance = _listByInstance; this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._listByInstanceNext = _listByInstanceNext; } /** @@ -578,8 +854,8 @@ class ManagedServerSecurityAlertPolicies { * @param {object} parameters The managed server security alert policy. * * @param {string} parameters.state Specifies the state of the policy, whether - * it is enabled or disabled. Possible values include: 'New', 'Enabled', - * 'Disabled' + * it is enabled or disabled or a policy has not been applied yet on the + * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -639,8 +915,8 @@ class ManagedServerSecurityAlertPolicies { * @param {object} parameters The managed server security alert policy. * * @param {string} parameters.state Specifies the state of the policy, whether - * it is enabled or disabled. Possible values include: 'New', 'Enabled', - * 'Disabled' + * it is enabled or disabled or a policy has not been applied yet on the + * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -711,6 +987,97 @@ class ManagedServerSecurityAlertPolicies { } } + /** + * Get the managed server's threat detection policies. + * + * @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} managedInstanceName The name of the managed instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByInstanceWithHttpOperationResponse(resourceGroupName, managedInstanceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByInstance(resourceGroupName, managedInstanceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get the managed server's threat detection policies. + * + * @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} managedInstanceName The name of the managed instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ManagedServerSecurityAlertPolicyListResult} - The deserialized 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 ManagedServerSecurityAlertPolicyListResult} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByInstance(resourceGroupName, managedInstanceName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByInstance(resourceGroupName, managedInstanceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByInstance(resourceGroupName, managedInstanceName, options, optionalCallback); + } + } + /** * Creates or updates a threat detection policy. * @@ -723,8 +1090,8 @@ class ManagedServerSecurityAlertPolicies { * @param {object} parameters The managed server security alert policy. * * @param {string} parameters.state Specifies the state of the policy, whether - * it is enabled or disabled. Possible values include: 'New', 'Enabled', - * 'Disabled' + * it is enabled or disabled or a policy has not been applied yet on the + * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -784,8 +1151,8 @@ class ManagedServerSecurityAlertPolicies { * @param {object} parameters The managed server security alert policy. * * @param {string} parameters.state Specifies the state of the policy, whether - * it is enabled or disabled. Possible values include: 'New', 'Enabled', - * 'Disabled' + * it is enabled or disabled or a policy has not been applied yet on the + * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -856,6 +1223,91 @@ class ManagedServerSecurityAlertPolicies { } } + /** + * Get the managed server's threat detection policies. + * + * @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. + */ + listByInstanceNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByInstanceNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get the managed server's threat detection policies. + * + * @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 {ManagedServerSecurityAlertPolicyListResult} - The deserialized 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 ManagedServerSecurityAlertPolicyListResult} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByInstanceNext(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._listByInstanceNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByInstanceNext(nextPageLink, options, optionalCallback); + } + } + } module.exports = ManagedServerSecurityAlertPolicies; diff --git a/lib/services/sqlManagement2/lib/operations/serverSecurityAlertPolicies.js b/lib/services/sqlManagement2/lib/operations/serverSecurityAlertPolicies.js index dbe17f3e64..9be31b1d47 100644 --- a/lib/services/sqlManagement2/lib/operations/serverSecurityAlertPolicies.js +++ b/lib/services/sqlManagement2/lib/operations/serverSecurityAlertPolicies.js @@ -175,8 +175,8 @@ function _get(resourceGroupName, serverName, options, callback) { * @param {object} parameters The server security alert policy. * * @param {string} parameters.state Specifies the state of the policy, whether - * it is enabled or disabled. Possible values include: 'New', 'Enabled', - * 'Disabled' + * it is enabled or disabled or a policy has not been applied yet on the + * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -270,6 +270,152 @@ function _createOrUpdate(resourceGroupName, serverName, parameters, options, cal }); } +/** + * Get the server's threat detection policies. + * + * @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 {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * 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 LogicalServerSecurityAlertPolicyListResult} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByServer(resourceGroupName, serverName, options, callback) { + /* jshint 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 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 (this.client.subscriptionId === null || this.client.subscriptionId === undefined || 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}/securityAlertPolicies'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + 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['LogicalServerSecurityAlertPolicyListResult']().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); + }); +} + /** * Creates or updates a threat detection policy. * @@ -282,8 +428,8 @@ function _createOrUpdate(resourceGroupName, serverName, parameters, options, cal * @param {object} parameters The server security alert policy. * * @param {string} parameters.state Specifies the state of the policy, whether - * it is enabled or disabled. Possible values include: 'New', 'Enabled', - * 'Disabled' + * it is enabled or disabled or a policy has not been applied yet on the + * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -462,6 +608,134 @@ function _beginCreateOrUpdate(resourceGroupName, serverName, parameters, options }); } +/** + * Get the server's threat detection policies. + * + * @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 LogicalServerSecurityAlertPolicyListResult} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByServerNext(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['LogicalServerSecurityAlertPolicyListResult']().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 ServerSecurityAlertPolicies. */ class ServerSecurityAlertPolicies { /** @@ -472,7 +746,9 @@ class ServerSecurityAlertPolicies { this.client = client; this._get = _get; this._createOrUpdate = _createOrUpdate; + this._listByServer = _listByServer; this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._listByServerNext = _listByServerNext; } /** @@ -578,8 +854,8 @@ class ServerSecurityAlertPolicies { * @param {object} parameters The server security alert policy. * * @param {string} parameters.state Specifies the state of the policy, whether - * it is enabled or disabled. Possible values include: 'New', 'Enabled', - * 'Disabled' + * it is enabled or disabled or a policy has not been applied yet on the + * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -639,8 +915,8 @@ class ServerSecurityAlertPolicies { * @param {object} parameters The server security alert policy. * * @param {string} parameters.state Specifies the state of the policy, whether - * it is enabled or disabled. Possible values include: 'New', 'Enabled', - * 'Disabled' + * it is enabled or disabled or a policy has not been applied yet on the + * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -711,6 +987,97 @@ class ServerSecurityAlertPolicies { } } + /** + * Get the server's threat detection policies. + * + * @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 {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByServerWithHttpOperationResponse(resourceGroupName, serverName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByServer(resourceGroupName, serverName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get the server's threat detection policies. + * + * @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 {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {LogicalServerSecurityAlertPolicyListResult} - The deserialized 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 LogicalServerSecurityAlertPolicyListResult} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByServer(resourceGroupName, serverName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByServer(resourceGroupName, serverName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByServer(resourceGroupName, serverName, options, optionalCallback); + } + } + /** * Creates or updates a threat detection policy. * @@ -723,8 +1090,8 @@ class ServerSecurityAlertPolicies { * @param {object} parameters The server security alert policy. * * @param {string} parameters.state Specifies the state of the policy, whether - * it is enabled or disabled. Possible values include: 'New', 'Enabled', - * 'Disabled' + * it is enabled or disabled or a policy has not been applied yet on the + * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -784,8 +1151,8 @@ class ServerSecurityAlertPolicies { * @param {object} parameters The server security alert policy. * * @param {string} parameters.state Specifies the state of the policy, whether - * it is enabled or disabled. Possible values include: 'New', 'Enabled', - * 'Disabled' + * it is enabled or disabled or a policy has not been applied yet on the + * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -856,6 +1223,91 @@ class ServerSecurityAlertPolicies { } } + /** + * Get the server's threat detection policies. + * + * @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. + */ + listByServerNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByServerNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get the server's threat detection policies. + * + * @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 {LogicalServerSecurityAlertPolicyListResult} - The deserialized 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 LogicalServerSecurityAlertPolicyListResult} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByServerNext(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._listByServerNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByServerNext(nextPageLink, options, optionalCallback); + } + } + } module.exports = ServerSecurityAlertPolicies; From 504b4eeb441d8e457e1652c527259b5eef942645 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Sun, 20 Jan 2019 11:06:52 +0000 Subject: [PATCH 2/2] Generated from d4e6f4b5b04154faca5593d376ba00579177bed1 Revert "Added missing description change" This reverts commit 17aeab7011d6085d08e562248eb89c2b2fe40277. --- .../sqlManagement2/lib/models/index.d.ts | 6 +++--- .../managedDatabaseSecurityAlertPolicy.js | 2 +- .../managedServerSecurityAlertPolicy.js | 2 +- .../lib/models/serverSecurityAlertPolicy.js | 2 +- .../sqlManagement2/lib/operations/index.d.ts | 20 +++++++++---------- .../managedDatabaseSecurityAlertPolicies.js | 6 +++--- .../managedServerSecurityAlertPolicies.js | 12 +++++------ .../operations/serverSecurityAlertPolicies.js | 12 +++++------ 8 files changed, 31 insertions(+), 31 deletions(-) diff --git a/lib/services/sqlManagement2/lib/models/index.d.ts b/lib/services/sqlManagement2/lib/models/index.d.ts index 6ce2d8493b..4e6f5134b7 100644 --- a/lib/services/sqlManagement2/lib/models/index.d.ts +++ b/lib/services/sqlManagement2/lib/models/index.d.ts @@ -3090,7 +3090,7 @@ export interface ServerDnsAliasAcquisition { * * @property {string} state Specifies the state of the policy, whether it is * enabled or disabled or a policy has not been applied yet on the specific - * resource. Possible values include: 'New', 'Enabled', 'Disabled' + * database. Possible values include: 'New', 'Enabled', 'Disabled' * @property {array} [disabledAlerts] Specifies an array of alerts that are * disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, * Access_Anomaly, Data_Exfiltration, Unsafe_Action @@ -3184,7 +3184,7 @@ export interface CreateDatabaseRestorePointDefinition { * * @property {string} state Specifies the state of the policy, whether it is * enabled or disabled or a policy has not been applied yet on the specific - * resource. Possible values include: 'New', 'Enabled', 'Disabled' + * database. Possible values include: 'New', 'Enabled', 'Disabled' * @property {array} [disabledAlerts] Specifies an array of alerts that are * disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, * Access_Anomaly, Data_Exfiltration, Unsafe_Action @@ -3221,7 +3221,7 @@ export interface ManagedDatabaseSecurityAlertPolicy extends ProxyResource { * * @property {string} state Specifies the state of the policy, whether it is * enabled or disabled or a policy has not been applied yet on the specific - * resource. Possible values include: 'New', 'Enabled', 'Disabled' + * database. Possible values include: 'New', 'Enabled', 'Disabled' * @property {array} [disabledAlerts] Specifies an array of alerts that are * disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, * Access_Anomaly, Data_Exfiltration, Unsafe_Action diff --git a/lib/services/sqlManagement2/lib/models/managedDatabaseSecurityAlertPolicy.js b/lib/services/sqlManagement2/lib/models/managedDatabaseSecurityAlertPolicy.js index a593f82d20..8983b8da2e 100644 --- a/lib/services/sqlManagement2/lib/models/managedDatabaseSecurityAlertPolicy.js +++ b/lib/services/sqlManagement2/lib/models/managedDatabaseSecurityAlertPolicy.js @@ -22,7 +22,7 @@ class ManagedDatabaseSecurityAlertPolicy extends models['ProxyResource'] { * Create a ManagedDatabaseSecurityAlertPolicy. * @property {string} state Specifies the state of the policy, whether it is * enabled or disabled or a policy has not been applied yet on the specific - * resource. Possible values include: 'New', 'Enabled', 'Disabled' + * database. Possible values include: 'New', 'Enabled', 'Disabled' * @property {array} [disabledAlerts] Specifies an array of alerts that are * disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, * Access_Anomaly, Data_Exfiltration, Unsafe_Action diff --git a/lib/services/sqlManagement2/lib/models/managedServerSecurityAlertPolicy.js b/lib/services/sqlManagement2/lib/models/managedServerSecurityAlertPolicy.js index 0b2f19bc6b..ca60aa4d0d 100644 --- a/lib/services/sqlManagement2/lib/models/managedServerSecurityAlertPolicy.js +++ b/lib/services/sqlManagement2/lib/models/managedServerSecurityAlertPolicy.js @@ -22,7 +22,7 @@ class ManagedServerSecurityAlertPolicy extends models['ProxyResource'] { * Create a ManagedServerSecurityAlertPolicy. * @property {string} state Specifies the state of the policy, whether it is * enabled or disabled or a policy has not been applied yet on the specific - * resource. Possible values include: 'New', 'Enabled', 'Disabled' + * database. Possible values include: 'New', 'Enabled', 'Disabled' * @property {array} [disabledAlerts] Specifies an array of alerts that are * disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, * Access_Anomaly, Data_Exfiltration, Unsafe_Action diff --git a/lib/services/sqlManagement2/lib/models/serverSecurityAlertPolicy.js b/lib/services/sqlManagement2/lib/models/serverSecurityAlertPolicy.js index 499ea9a6b5..7a6b417908 100644 --- a/lib/services/sqlManagement2/lib/models/serverSecurityAlertPolicy.js +++ b/lib/services/sqlManagement2/lib/models/serverSecurityAlertPolicy.js @@ -22,7 +22,7 @@ class ServerSecurityAlertPolicy extends models['ProxyResource'] { * Create a ServerSecurityAlertPolicy. * @property {string} state Specifies the state of the policy, whether it is * enabled or disabled or a policy has not been applied yet on the specific - * resource. Possible values include: 'New', 'Enabled', 'Disabled' + * database. Possible values include: 'New', 'Enabled', 'Disabled' * @property {array} [disabledAlerts] Specifies an array of alerts that are * disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, * Access_Anomaly, Data_Exfiltration, Unsafe_Action diff --git a/lib/services/sqlManagement2/lib/operations/index.d.ts b/lib/services/sqlManagement2/lib/operations/index.d.ts index 243d7f05d5..1e3088235c 100644 --- a/lib/services/sqlManagement2/lib/operations/index.d.ts +++ b/lib/services/sqlManagement2/lib/operations/index.d.ts @@ -27418,7 +27418,7 @@ export interface ServerSecurityAlertPolicies { * * @param {string} parameters.state Specifies the state of the policy, whether * it is enabled or disabled or a policy has not been applied yet on the - * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' + * specific database. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -27467,7 +27467,7 @@ export interface ServerSecurityAlertPolicies { * * @param {string} parameters.state Specifies the state of the policy, whether * it is enabled or disabled or a policy has not been applied yet on the - * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' + * specific database. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -27600,7 +27600,7 @@ export interface ServerSecurityAlertPolicies { * * @param {string} parameters.state Specifies the state of the policy, whether * it is enabled or disabled or a policy has not been applied yet on the - * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' + * specific database. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -27649,7 +27649,7 @@ export interface ServerSecurityAlertPolicies { * * @param {string} parameters.state Specifies the state of the policy, whether * it is enabled or disabled or a policy has not been applied yet on the - * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' + * specific database. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -28433,7 +28433,7 @@ export interface ManagedDatabaseSecurityAlertPolicies { * * @param {string} parameters.state Specifies the state of the policy, whether * it is enabled or disabled or a policy has not been applied yet on the - * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' + * specific database. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -28485,7 +28485,7 @@ export interface ManagedDatabaseSecurityAlertPolicies { * * @param {string} parameters.state Specifies the state of the policy, whether * it is enabled or disabled or a policy has not been applied yet on the - * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' + * specific database. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -28757,7 +28757,7 @@ export interface ManagedServerSecurityAlertPolicies { * * @param {string} parameters.state Specifies the state of the policy, whether * it is enabled or disabled or a policy has not been applied yet on the - * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' + * specific database. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -28806,7 +28806,7 @@ export interface ManagedServerSecurityAlertPolicies { * * @param {string} parameters.state Specifies the state of the policy, whether * it is enabled or disabled or a policy has not been applied yet on the - * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' + * specific database. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -28939,7 +28939,7 @@ export interface ManagedServerSecurityAlertPolicies { * * @param {string} parameters.state Specifies the state of the policy, whether * it is enabled or disabled or a policy has not been applied yet on the - * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' + * specific database. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -28988,7 +28988,7 @@ export interface ManagedServerSecurityAlertPolicies { * * @param {string} parameters.state Specifies the state of the policy, whether * it is enabled or disabled or a policy has not been applied yet on the - * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' + * specific database. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, diff --git a/lib/services/sqlManagement2/lib/operations/managedDatabaseSecurityAlertPolicies.js b/lib/services/sqlManagement2/lib/operations/managedDatabaseSecurityAlertPolicies.js index d51aa844e0..32819c3cfc 100644 --- a/lib/services/sqlManagement2/lib/operations/managedDatabaseSecurityAlertPolicies.js +++ b/lib/services/sqlManagement2/lib/operations/managedDatabaseSecurityAlertPolicies.js @@ -185,7 +185,7 @@ function _get(resourceGroupName, managedInstanceName, databaseName, options, cal * * @param {string} parameters.state Specifies the state of the policy, whether * it is enabled or disabled or a policy has not been applied yet on the - * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' + * specific database. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -795,7 +795,7 @@ class ManagedDatabaseSecurityAlertPolicies { * * @param {string} parameters.state Specifies the state of the policy, whether * it is enabled or disabled or a policy has not been applied yet on the - * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' + * specific database. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -859,7 +859,7 @@ class ManagedDatabaseSecurityAlertPolicies { * * @param {string} parameters.state Specifies the state of the policy, whether * it is enabled or disabled or a policy has not been applied yet on the - * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' + * specific database. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, diff --git a/lib/services/sqlManagement2/lib/operations/managedServerSecurityAlertPolicies.js b/lib/services/sqlManagement2/lib/operations/managedServerSecurityAlertPolicies.js index a0245bfcc8..a0567b1b6f 100644 --- a/lib/services/sqlManagement2/lib/operations/managedServerSecurityAlertPolicies.js +++ b/lib/services/sqlManagement2/lib/operations/managedServerSecurityAlertPolicies.js @@ -176,7 +176,7 @@ function _get(resourceGroupName, managedInstanceName, options, callback) { * * @param {string} parameters.state Specifies the state of the policy, whether * it is enabled or disabled or a policy has not been applied yet on the - * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' + * specific database. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -429,7 +429,7 @@ function _listByInstance(resourceGroupName, managedInstanceName, options, callba * * @param {string} parameters.state Specifies the state of the policy, whether * it is enabled or disabled or a policy has not been applied yet on the - * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' + * specific database. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -855,7 +855,7 @@ class ManagedServerSecurityAlertPolicies { * * @param {string} parameters.state Specifies the state of the policy, whether * it is enabled or disabled or a policy has not been applied yet on the - * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' + * specific database. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -916,7 +916,7 @@ class ManagedServerSecurityAlertPolicies { * * @param {string} parameters.state Specifies the state of the policy, whether * it is enabled or disabled or a policy has not been applied yet on the - * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' + * specific database. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -1091,7 +1091,7 @@ class ManagedServerSecurityAlertPolicies { * * @param {string} parameters.state Specifies the state of the policy, whether * it is enabled or disabled or a policy has not been applied yet on the - * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' + * specific database. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -1152,7 +1152,7 @@ class ManagedServerSecurityAlertPolicies { * * @param {string} parameters.state Specifies the state of the policy, whether * it is enabled or disabled or a policy has not been applied yet on the - * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' + * specific database. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, diff --git a/lib/services/sqlManagement2/lib/operations/serverSecurityAlertPolicies.js b/lib/services/sqlManagement2/lib/operations/serverSecurityAlertPolicies.js index 9be31b1d47..583bb19760 100644 --- a/lib/services/sqlManagement2/lib/operations/serverSecurityAlertPolicies.js +++ b/lib/services/sqlManagement2/lib/operations/serverSecurityAlertPolicies.js @@ -176,7 +176,7 @@ function _get(resourceGroupName, serverName, options, callback) { * * @param {string} parameters.state Specifies the state of the policy, whether * it is enabled or disabled or a policy has not been applied yet on the - * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' + * specific database. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -429,7 +429,7 @@ function _listByServer(resourceGroupName, serverName, options, callback) { * * @param {string} parameters.state Specifies the state of the policy, whether * it is enabled or disabled or a policy has not been applied yet on the - * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' + * specific database. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -855,7 +855,7 @@ class ServerSecurityAlertPolicies { * * @param {string} parameters.state Specifies the state of the policy, whether * it is enabled or disabled or a policy has not been applied yet on the - * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' + * specific database. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -916,7 +916,7 @@ class ServerSecurityAlertPolicies { * * @param {string} parameters.state Specifies the state of the policy, whether * it is enabled or disabled or a policy has not been applied yet on the - * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' + * specific database. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -1091,7 +1091,7 @@ class ServerSecurityAlertPolicies { * * @param {string} parameters.state Specifies the state of the policy, whether * it is enabled or disabled or a policy has not been applied yet on the - * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' + * specific database. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection, @@ -1152,7 +1152,7 @@ class ServerSecurityAlertPolicies { * * @param {string} parameters.state Specifies the state of the policy, whether * it is enabled or disabled or a policy has not been applied yet on the - * specific resource. Possible values include: 'New', 'Enabled', 'Disabled' + * specific database. Possible values include: 'New', 'Enabled', 'Disabled' * * @param {array} [parameters.disabledAlerts] Specifies an array of alerts that * are disabled. Allowed values are: Sql_Injection,