diff --git a/lib/services/securityManagement/LICENSE.txt b/lib/services/securityManagement/LICENSE.txt index 5431ba98b9..8f3d856145 100644 --- a/lib/services/securityManagement/LICENSE.txt +++ b/lib/services/securityManagement/LICENSE.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2018 Microsoft +Copyright (c) 2019 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/lib/services/securityManagement/lib/models/allowlistCustomAlertRule.js b/lib/services/securityManagement/lib/models/allowlistCustomAlertRule.js new file mode 100644 index 0000000000..02a1f5668e --- /dev/null +++ b/lib/services/securityManagement/lib/models/allowlistCustomAlertRule.js @@ -0,0 +1,95 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * A custom alert rule that checks if a value (depends on the custom alert + * type) is allowed + * + * @extends models['CustomAlertRule'] + */ +class AllowlistCustomAlertRule extends models['CustomAlertRule'] { + /** + * Create a AllowlistCustomAlertRule. + * @property {array} allowlistValues The values to allow. The format of the + * values depends on the rule type. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of AllowlistCustomAlertRule + * + * @returns {object} metadata of AllowlistCustomAlertRule + * + */ + mapper() { + return { + required: false, + serializedName: 'AllowlistCustomAlertRule', + type: { + name: 'Composite', + className: 'AllowlistCustomAlertRule', + modelProperties: { + displayName: { + required: false, + readOnly: true, + serializedName: 'displayName', + type: { + name: 'String' + } + }, + description: { + required: false, + readOnly: true, + serializedName: 'description', + type: { + name: 'String' + } + }, + isEnabled: { + required: true, + serializedName: 'isEnabled', + type: { + name: 'Boolean' + } + }, + ruleType: { + required: true, + serializedName: 'ruleType', + type: { + name: 'String' + } + }, + allowlistValues: { + required: true, + serializedName: 'allowlistValues', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = AllowlistCustomAlertRule; diff --git a/lib/services/securityManagement/lib/models/customAlertRule.js b/lib/services/securityManagement/lib/models/customAlertRule.js new file mode 100644 index 0000000000..15cf1bb4a3 --- /dev/null +++ b/lib/services/securityManagement/lib/models/customAlertRule.js @@ -0,0 +1,78 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * A custom alert rule + * + */ +class CustomAlertRule { + /** + * Create a CustomAlertRule. + * @property {string} [displayName] The display name of the custom alert. + * @property {string} [description] The description of the custom alert. + * @property {boolean} isEnabled Whether the custom alert is enabled. + * @property {string} ruleType The type of the custom alert rule. + */ + constructor() { + } + + /** + * Defines the metadata of CustomAlertRule + * + * @returns {object} metadata of CustomAlertRule + * + */ + mapper() { + return { + required: false, + serializedName: 'CustomAlertRule', + type: { + name: 'Composite', + className: 'CustomAlertRule', + modelProperties: { + displayName: { + required: false, + readOnly: true, + serializedName: 'displayName', + type: { + name: 'String' + } + }, + description: { + required: false, + readOnly: true, + serializedName: 'description', + type: { + name: 'String' + } + }, + isEnabled: { + required: true, + serializedName: 'isEnabled', + type: { + name: 'Boolean' + } + }, + ruleType: { + required: true, + serializedName: 'ruleType', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = CustomAlertRule; diff --git a/lib/services/securityManagement/lib/models/dataExportSetting.js b/lib/services/securityManagement/lib/models/dataExportSetting.js index d3b981b852..cd688e51fa 100644 --- a/lib/services/securityManagement/lib/models/dataExportSetting.js +++ b/lib/services/securityManagement/lib/models/dataExportSetting.js @@ -38,11 +38,6 @@ class DataExportSetting extends models['Setting'] { serializedName: 'DataExportSetting', type: { name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'kind', - clientName: 'kind' - }, - uberParent: 'Setting', className: 'DataExportSetting', modelProperties: { id: { @@ -72,7 +67,6 @@ class DataExportSetting extends models['Setting'] { kind: { required: true, serializedName: 'kind', - isPolymorphicDiscriminator: true, type: { name: 'String' } diff --git a/lib/services/securityManagement/lib/models/denylistCustomAlertRule.js b/lib/services/securityManagement/lib/models/denylistCustomAlertRule.js new file mode 100644 index 0000000000..d9a89b63d9 --- /dev/null +++ b/lib/services/securityManagement/lib/models/denylistCustomAlertRule.js @@ -0,0 +1,95 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * A custom alert rule that checks if a value (depends on the custom alert + * type) is denied + * + * @extends models['CustomAlertRule'] + */ +class DenylistCustomAlertRule extends models['CustomAlertRule'] { + /** + * Create a DenylistCustomAlertRule. + * @property {array} denylistValues The values to deny. The format of the + * values depends on the rule type. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DenylistCustomAlertRule + * + * @returns {object} metadata of DenylistCustomAlertRule + * + */ + mapper() { + return { + required: false, + serializedName: 'DenylistCustomAlertRule', + type: { + name: 'Composite', + className: 'DenylistCustomAlertRule', + modelProperties: { + displayName: { + required: false, + readOnly: true, + serializedName: 'displayName', + type: { + name: 'String' + } + }, + description: { + required: false, + readOnly: true, + serializedName: 'description', + type: { + name: 'String' + } + }, + isEnabled: { + required: true, + serializedName: 'isEnabled', + type: { + name: 'Boolean' + } + }, + ruleType: { + required: true, + serializedName: 'ruleType', + type: { + name: 'String' + } + }, + denylistValues: { + required: true, + serializedName: 'denylistValues', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = DenylistCustomAlertRule; diff --git a/lib/services/securityManagement/lib/models/deviceSecurityGroup.js b/lib/services/securityManagement/lib/models/deviceSecurityGroup.js new file mode 100644 index 0000000000..a137b58229 --- /dev/null +++ b/lib/services/securityManagement/lib/models/deviceSecurityGroup.js @@ -0,0 +1,138 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The device security group resource + * + * @extends models['Resource'] + */ +class DeviceSecurityGroup extends models['Resource'] { + /** + * Create a DeviceSecurityGroup. + * @property {array} [thresholdRules] A list of threshold custom alert rules. + * @property {array} [timeWindowRules] A list of time window custom alert + * rules. + * @property {array} [allowlistRules] A list of allow-list custom alert + * rules. + * @property {array} [denylistRules] A list of deny-list custom alert rules. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DeviceSecurityGroup + * + * @returns {object} metadata of DeviceSecurityGroup + * + */ + mapper() { + return { + required: false, + serializedName: 'DeviceSecurityGroup', + type: { + name: 'Composite', + className: 'DeviceSecurityGroup', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + thresholdRules: { + required: false, + serializedName: 'properties.thresholdRules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ThresholdCustomAlertRuleElementType', + type: { + name: 'Composite', + className: 'ThresholdCustomAlertRule' + } + } + } + }, + timeWindowRules: { + required: false, + serializedName: 'properties.timeWindowRules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'TimeWindowCustomAlertRuleElementType', + type: { + name: 'Composite', + className: 'TimeWindowCustomAlertRule' + } + } + } + }, + allowlistRules: { + required: false, + serializedName: 'properties.allowlistRules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AllowlistCustomAlertRuleElementType', + type: { + name: 'Composite', + className: 'AllowlistCustomAlertRule' + } + } + } + }, + denylistRules: { + required: false, + serializedName: 'properties.denylistRules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DenylistCustomAlertRuleElementType', + type: { + name: 'Composite', + className: 'DenylistCustomAlertRule' + } + } + } + } + } + } + }; + } +} + +module.exports = DeviceSecurityGroup; diff --git a/lib/services/securityManagement/lib/models/deviceSecurityGroupList.js b/lib/services/securityManagement/lib/models/deviceSecurityGroupList.js new file mode 100644 index 0000000000..f804a7301b --- /dev/null +++ b/lib/services/securityManagement/lib/models/deviceSecurityGroupList.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * List of device security groups + */ +class DeviceSecurityGroupList extends Array { + /** + * Create a DeviceSecurityGroupList. + * @property {string} [nextLink] The URI to fetch the next page. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DeviceSecurityGroupList + * + * @returns {object} metadata of DeviceSecurityGroupList + * + */ + mapper() { + return { + required: false, + serializedName: 'DeviceSecurityGroupList', + type: { + name: 'Composite', + className: 'DeviceSecurityGroupList', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DeviceSecurityGroupElementType', + type: { + name: 'Composite', + className: 'DeviceSecurityGroup' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DeviceSecurityGroupList; diff --git a/lib/services/securityManagement/lib/models/index.d.ts b/lib/services/securityManagement/lib/models/index.d.ts index daf1bd1cb5..ff036b9b13 100644 --- a/lib/services/securityManagement/lib/models/index.d.ts +++ b/lib/services/securityManagement/lib/models/index.d.ts @@ -147,45 +147,30 @@ export interface AdvancedThreatProtectionSetting extends Resource { } /** - * Represents a security setting in Azure Security Center. + * The kind of the security setting */ -export interface Setting { +export interface SettingResource extends Resource { /** - * Resource Id - */ - readonly id?: string; - /** - * Resource name - */ - readonly name?: string; - /** - * Resource type - */ - readonly type?: string; - /** - * Polymorphic Discriminator + * the kind of the settings string (DataExportSetting). Possible values include: + * 'DataExportSetting', 'AlertSuppressionSetting' */ kind: string; } /** - * Represents a data export setting + * Represents a security setting in Azure Security Center. */ -export interface DataExportSetting extends Setting { - /** - * Is the data export setting is enabled - */ - enabled: boolean; +export interface Setting extends SettingResource { } /** - * The kind of the security setting + * Represents a data export setting */ -export interface SettingKind1 { +export interface DataExportSetting extends Setting { /** - * the kind of the settings string. Possible values include: 'DataExportSetting' + * Is the data export setting is enabled */ - kind?: string; + enabled: boolean; } /** @@ -276,6 +261,120 @@ export interface InformationProtectionPolicy extends Resource { informationTypes?: { [propertyName: string]: InformationType }; } +/** + * A custom alert rule + */ +export interface CustomAlertRule { + /** + * The display name of the custom alert. + */ + readonly displayName?: string; + /** + * The description of the custom alert. + */ + readonly description?: string; + /** + * Whether the custom alert is enabled. + */ + isEnabled: boolean; + /** + * The type of the custom alert rule. + */ + ruleType: string; +} + +/** + * A custom alert rule that checks if a value (depends on the custom alert type) is within the + * given range. + */ +export interface ThresholdCustomAlertRule extends CustomAlertRule { + /** + * The minimum threshold. + */ + minThreshold: number; + /** + * The maximum threshold. + */ + maxThreshold: number; +} + +/** + * A custom alert rule that checks if the number of activities (depends on the custom alert type) + * in a time window is within the given range. + */ +export interface TimeWindowCustomAlertRule { + /** + * The display name of the custom alert. + */ + readonly displayName?: string; + /** + * The description of the custom alert. + */ + readonly description?: string; + /** + * Whether the custom alert is enabled. + */ + isEnabled: boolean; + /** + * The type of the custom alert rule. + */ + ruleType: string; + /** + * The minimum threshold. + */ + minThreshold: number; + /** + * The maximum threshold. + */ + maxThreshold: number; + /** + * The time window size in iso8601 format. + */ + timeWindowSize: moment.Duration; +} + +/** + * A custom alert rule that checks if a value (depends on the custom alert type) is allowed + */ +export interface AllowlistCustomAlertRule extends CustomAlertRule { + /** + * The values to allow. The format of the values depends on the rule type. + */ + allowlistValues: string[]; +} + +/** + * A custom alert rule that checks if a value (depends on the custom alert type) is denied + */ +export interface DenylistCustomAlertRule extends CustomAlertRule { + /** + * The values to deny. The format of the values depends on the rule type. + */ + denylistValues: string[]; +} + +/** + * The device security group resource + */ +export interface DeviceSecurityGroup extends Resource { + /** + * A list of threshold custom alert rules. + */ + thresholdRules?: ThresholdCustomAlertRule[]; + /** + * A list of time window custom alert rules. + */ + timeWindowRules?: TimeWindowCustomAlertRule[]; + /** + * A list of allow-list custom alert rules. + */ + allowlistRules?: AllowlistCustomAlertRule[]; + /** + * A list of deny-list custom alert rules. + */ + denylistRules?: DenylistCustomAlertRule[]; +} + /** * Describes an Azure resource with location */ @@ -978,6 +1077,16 @@ export interface ComplianceList extends Array { readonly nextLink?: string; } +/** + * List of device security groups +*/ +export interface DeviceSecurityGroupList extends Array { + /** + * The URI to fetch the next page. + */ + readonly nextLink?: string; +} + /** * Subscription settings list. */ diff --git a/lib/services/securityManagement/lib/models/index.js b/lib/services/securityManagement/lib/models/index.js index 750d5ba0d8..e1d9449dd0 100644 --- a/lib/services/securityManagement/lib/models/index.js +++ b/lib/services/securityManagement/lib/models/index.js @@ -27,13 +27,19 @@ exports.AutoProvisioningSetting = require('./autoProvisioningSetting'); exports.ComplianceSegment = require('./complianceSegment'); exports.Compliance = require('./compliance'); exports.AdvancedThreatProtectionSetting = require('./advancedThreatProtectionSetting'); +exports.SettingResource = require('./settingResource'); exports.Setting = require('./setting'); exports.DataExportSetting = require('./dataExportSetting'); -exports.SettingKind1 = require('./settingKind1'); exports.SensitivityLabel = require('./sensitivityLabel'); exports.InformationProtectionKeyword = require('./informationProtectionKeyword'); exports.InformationType = require('./informationType'); exports.InformationProtectionPolicy = require('./informationProtectionPolicy'); +exports.CustomAlertRule = require('./customAlertRule'); +exports.ThresholdCustomAlertRule = require('./thresholdCustomAlertRule'); +exports.TimeWindowCustomAlertRule = require('./timeWindowCustomAlertRule'); +exports.AllowlistCustomAlertRule = require('./allowlistCustomAlertRule'); +exports.DenylistCustomAlertRule = require('./denylistCustomAlertRule'); +exports.DeviceSecurityGroup = require('./deviceSecurityGroup'); exports.Location = require('./location'); exports.OperationDisplay = require('./operationDisplay'); exports.Operation = require('./operation'); @@ -76,6 +82,7 @@ exports.SecurityContactList = require('./securityContactList'); exports.WorkspaceSettingList = require('./workspaceSettingList'); exports.AutoProvisioningSettingList = require('./autoProvisioningSettingList'); exports.ComplianceList = require('./complianceList'); +exports.DeviceSecurityGroupList = require('./deviceSecurityGroupList'); exports.SettingsList = require('./settingsList'); exports.InformationProtectionPolicyList = require('./informationProtectionPolicyList'); exports.OperationList = require('./operationList'); @@ -88,8 +95,6 @@ exports.ExternalSecuritySolutionList = require('./externalSecuritySolutionList') exports.TopologyList = require('./topologyList'); exports.AllowedConnectionsList = require('./allowedConnectionsList'); exports.discriminators = { - 'Setting' : exports.Setting, - 'Setting.DataExportSetting' : exports.DataExportSetting, 'ExternalSecuritySolution' : exports.ExternalSecuritySolution, 'ExternalSecuritySolution.CEF' : exports.CefExternalSecuritySolution, 'ExternalSecuritySolution.ATA' : exports.AtaExternalSecuritySolution, diff --git a/lib/services/securityManagement/lib/models/iotSecurityGroup.js b/lib/services/securityManagement/lib/models/iotSecurityGroup.js new file mode 100644 index 0000000000..4db9e5557c --- /dev/null +++ b/lib/services/securityManagement/lib/models/iotSecurityGroup.js @@ -0,0 +1,138 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The IoT security group resource + * + * @extends models['Resource'] + */ +class IotSecurityGroup extends models['Resource'] { + /** + * Create a IotSecurityGroup. + * @property {array} [thresholdRules] A list of threshold custom alert rules. + * @property {array} [timeWindowRules] A list of time window custom alert + * rules. + * @property {array} [allowlistRules] A list of allow-list custom alert + * rules. + * @property {array} [denylistRules] A list of deny-list custom alert rules. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of IotSecurityGroup + * + * @returns {object} metadata of IotSecurityGroup + * + */ + mapper() { + return { + required: false, + serializedName: 'IotSecurityGroup', + type: { + name: 'Composite', + className: 'IotSecurityGroup', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + thresholdRules: { + required: false, + serializedName: 'properties.thresholdRules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ThresholdCustomAlertRuleElementType', + type: { + name: 'Composite', + className: 'ThresholdCustomAlertRule' + } + } + } + }, + timeWindowRules: { + required: false, + serializedName: 'properties.timeWindowRules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'TimeWindowCustomAlertRuleElementType', + type: { + name: 'Composite', + className: 'TimeWindowCustomAlertRule' + } + } + } + }, + allowlistRules: { + required: false, + serializedName: 'properties.allowlistRules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AllowlistCustomAlertRuleElementType', + type: { + name: 'Composite', + className: 'AllowlistCustomAlertRule' + } + } + } + }, + denylistRules: { + required: false, + serializedName: 'properties.denylistRules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DenylistCustomAlertRuleElementType', + type: { + name: 'Composite', + className: 'DenylistCustomAlertRule' + } + } + } + } + } + } + }; + } +} + +module.exports = IotSecurityGroup; diff --git a/lib/services/securityManagement/lib/models/iotSecurityGroupList.js b/lib/services/securityManagement/lib/models/iotSecurityGroupList.js new file mode 100644 index 0000000000..4f5e58ddf4 --- /dev/null +++ b/lib/services/securityManagement/lib/models/iotSecurityGroupList.js @@ -0,0 +1,60 @@ +/* + * 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'; + +/** + * List of IoT security groups + * + */ +class IotSecurityGroupList { + /** + * Create a IotSecurityGroupList. + * @property {array} [value] List of IoT security group objects + */ + constructor() { + } + + /** + * Defines the metadata of IotSecurityGroupList + * + * @returns {object} metadata of IotSecurityGroupList + * + */ + mapper() { + return { + required: false, + serializedName: 'IotSecurityGroupList', + type: { + name: 'Composite', + className: 'IotSecurityGroupList', + modelProperties: { + value: { + required: false, + serializedName: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'IotSecurityGroupElementType', + type: { + name: 'Composite', + className: 'IotSecurityGroup' + } + } + } + } + } + } + }; + } +} + +module.exports = IotSecurityGroupList; diff --git a/lib/services/securityManagement/lib/models/setting.js b/lib/services/securityManagement/lib/models/setting.js index b3fd15f090..6e7b01c8cc 100644 --- a/lib/services/securityManagement/lib/models/setting.js +++ b/lib/services/securityManagement/lib/models/setting.js @@ -10,19 +10,19 @@ 'use strict'; +const models = require('./index'); + /** * Represents a security setting in Azure Security Center. * + * @extends models['SettingResource'] */ -class Setting { +class Setting extends models['SettingResource'] { /** * Create a Setting. - * @property {string} [id] Resource Id - * @property {string} [name] Resource name - * @property {string} [type] Resource type - * @property {string} kind Polymorphic Discriminator */ constructor() { + super(); } /** @@ -37,11 +37,6 @@ class Setting { serializedName: 'Setting', type: { name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'kind', - clientName: 'kind' - }, - uberParent: 'Setting', className: 'Setting', modelProperties: { id: { @@ -71,7 +66,6 @@ class Setting { kind: { required: true, serializedName: 'kind', - isPolymorphicDiscriminator: true, type: { name: 'String' } diff --git a/lib/services/securityManagement/lib/models/settingResource.js b/lib/services/securityManagement/lib/models/settingResource.js new file mode 100644 index 0000000000..16e9f1f7e9 --- /dev/null +++ b/lib/services/securityManagement/lib/models/settingResource.js @@ -0,0 +1,82 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The kind of the security setting + * + * @extends models['Resource'] + */ +class SettingResource extends models['Resource'] { + /** + * Create a SettingResource. + * @property {string} kind the kind of the settings string + * (DataExportSetting). Possible values include: 'DataExportSetting', + * 'AlertSuppressionSetting' + */ + constructor() { + super(); + } + + /** + * Defines the metadata of SettingResource + * + * @returns {object} metadata of SettingResource + * + */ + mapper() { + return { + required: false, + serializedName: 'SettingResource', + type: { + name: 'Composite', + className: 'SettingResource', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + kind: { + required: true, + serializedName: 'kind', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SettingResource; diff --git a/lib/services/securityManagement/lib/models/settingsList.js b/lib/services/securityManagement/lib/models/settingsList.js index 428109a3ea..608398f0e7 100644 --- a/lib/services/securityManagement/lib/models/settingsList.js +++ b/lib/services/securityManagement/lib/models/settingsList.js @@ -46,11 +46,6 @@ class SettingsList extends Array { serializedName: 'SettingElementType', type: { name: 'Composite', - polymorphicDiscriminator: { - serializedName: 'kind', - clientName: 'kind' - }, - uberParent: 'Setting', className: 'Setting' } } diff --git a/lib/services/securityManagement/lib/models/thresholdCustomAlertRule.js b/lib/services/securityManagement/lib/models/thresholdCustomAlertRule.js new file mode 100644 index 0000000000..8a71aa1542 --- /dev/null +++ b/lib/services/securityManagement/lib/models/thresholdCustomAlertRule.js @@ -0,0 +1,95 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * A custom alert rule that checks if a value (depends on the custom alert + * type) is within the given range. + * + * @extends models['CustomAlertRule'] + */ +class ThresholdCustomAlertRule extends models['CustomAlertRule'] { + /** + * Create a ThresholdCustomAlertRule. + * @property {number} minThreshold The minimum threshold. + * @property {number} maxThreshold The maximum threshold. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ThresholdCustomAlertRule + * + * @returns {object} metadata of ThresholdCustomAlertRule + * + */ + mapper() { + return { + required: false, + serializedName: 'ThresholdCustomAlertRule', + type: { + name: 'Composite', + className: 'ThresholdCustomAlertRule', + modelProperties: { + displayName: { + required: false, + readOnly: true, + serializedName: 'displayName', + type: { + name: 'String' + } + }, + description: { + required: false, + readOnly: true, + serializedName: 'description', + type: { + name: 'String' + } + }, + isEnabled: { + required: true, + serializedName: 'isEnabled', + type: { + name: 'Boolean' + } + }, + ruleType: { + required: true, + serializedName: 'ruleType', + type: { + name: 'String' + } + }, + minThreshold: { + required: true, + serializedName: 'minThreshold', + type: { + name: 'Number' + } + }, + maxThreshold: { + required: true, + serializedName: 'maxThreshold', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = ThresholdCustomAlertRule; diff --git a/lib/services/securityManagement/lib/models/timeWindowCustomAlertRule.js b/lib/services/securityManagement/lib/models/timeWindowCustomAlertRule.js new file mode 100644 index 0000000000..47e232f144 --- /dev/null +++ b/lib/services/securityManagement/lib/models/timeWindowCustomAlertRule.js @@ -0,0 +1,104 @@ +/* + * 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 custom alert rule that checks if the number of activities (depends on the + * custom alert type) in a time window is within the given range. + * + */ +class TimeWindowCustomAlertRule { + /** + * Create a TimeWindowCustomAlertRule. + * @property {string} [displayName] The display name of the custom alert. + * @property {string} [description] The description of the custom alert. + * @property {boolean} isEnabled Whether the custom alert is enabled. + * @property {string} ruleType The type of the custom alert rule. + * @property {number} minThreshold The minimum threshold. + * @property {number} maxThreshold The maximum threshold. + * @property {moment.duration} timeWindowSize The time window size in iso8601 + * format. + */ + constructor() { + } + + /** + * Defines the metadata of TimeWindowCustomAlertRule + * + * @returns {object} metadata of TimeWindowCustomAlertRule + * + */ + mapper() { + return { + required: false, + serializedName: 'TimeWindowCustomAlertRule', + type: { + name: 'Composite', + className: 'TimeWindowCustomAlertRule', + modelProperties: { + displayName: { + required: false, + readOnly: true, + serializedName: 'displayName', + type: { + name: 'String' + } + }, + description: { + required: false, + readOnly: true, + serializedName: 'description', + type: { + name: 'String' + } + }, + isEnabled: { + required: true, + serializedName: 'isEnabled', + type: { + name: 'Boolean' + } + }, + ruleType: { + required: true, + serializedName: 'ruleType', + type: { + name: 'String' + } + }, + minThreshold: { + required: true, + serializedName: 'minThreshold', + type: { + name: 'Number' + } + }, + maxThreshold: { + required: true, + serializedName: 'maxThreshold', + type: { + name: 'Number' + } + }, + timeWindowSize: { + required: true, + serializedName: 'timeWindowSize', + type: { + name: 'TimeSpan' + } + } + } + } + }; + } +} + +module.exports = TimeWindowCustomAlertRule; diff --git a/lib/services/securityManagement/lib/operations/deviceSecurityGroups.js b/lib/services/securityManagement/lib/operations/deviceSecurityGroups.js new file mode 100644 index 0000000000..b810db1797 --- /dev/null +++ b/lib/services/securityManagement/lib/operations/deviceSecurityGroups.js @@ -0,0 +1,1208 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Gets the list of device security groups for the specified IoT hub resource. + * + * @param {string} resourceId The identifier of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link DeviceSecurityGroupList} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceId, 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-08-01-preview'; + // Validate + try { + if (resourceId === null || resourceId === undefined || typeof resourceId.valueOf() !== 'string') { + throw new Error('resourceId 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('/') ? '' : '/') + '{resourceId}/providers/Microsoft.Security/deviceSecurityGroups'; + requestUrl = requestUrl.replace('{resourceId}', encodeURIComponent(resourceId)); + 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['DeviceSecurityGroupList']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets the device security group for the specified IoT hub resource. + * + * @param {string} resourceId The identifier of the resource. + * + * @param {string} deviceSecurityGroupName The name of the security group. + * Please notice that the name is case insensitive. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link DeviceSecurityGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceId, deviceSecurityGroupName, 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-08-01-preview'; + // Validate + try { + if (resourceId === null || resourceId === undefined || typeof resourceId.valueOf() !== 'string') { + throw new Error('resourceId cannot be null or undefined and it must be of type string.'); + } + if (deviceSecurityGroupName === null || deviceSecurityGroupName === undefined || typeof deviceSecurityGroupName.valueOf() !== 'string') { + throw new Error('deviceSecurityGroupName 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('/') ? '' : '/') + '{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}'; + requestUrl = requestUrl.replace('{resourceId}', encodeURIComponent(resourceId)); + requestUrl = requestUrl.replace('{deviceSecurityGroupName}', encodeURIComponent(deviceSecurityGroupName)); + 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['DeviceSecurityGroup']().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 the device security group on a specified IoT hub + * resource. + * + * @param {string} resourceId The identifier of the resource. + * + * @param {string} deviceSecurityGroupName The name of the security group. + * Please notice that the name is case insensitive. + * + * @param {object} deviceSecurityGroup Security group object. + * + * @param {array} [deviceSecurityGroup.thresholdRules] A list of threshold + * custom alert rules. + * + * @param {array} [deviceSecurityGroup.timeWindowRules] A list of time window + * custom alert rules. + * + * @param {array} [deviceSecurityGroup.allowlistRules] A list of allow-list + * custom alert rules. + * + * @param {array} [deviceSecurityGroup.denylistRules] A list of deny-list + * custom alert rules. + * + * @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 DeviceSecurityGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceId, deviceSecurityGroupName, deviceSecurityGroup, 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-08-01-preview'; + // Validate + try { + if (resourceId === null || resourceId === undefined || typeof resourceId.valueOf() !== 'string') { + throw new Error('resourceId cannot be null or undefined and it must be of type string.'); + } + if (deviceSecurityGroupName === null || deviceSecurityGroupName === undefined || typeof deviceSecurityGroupName.valueOf() !== 'string') { + throw new Error('deviceSecurityGroupName cannot be null or undefined and it must be of type string.'); + } + if (deviceSecurityGroup === null || deviceSecurityGroup === undefined) { + throw new Error('deviceSecurityGroup cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + '{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}'; + requestUrl = requestUrl.replace('{resourceId}', encodeURIComponent(resourceId)); + requestUrl = requestUrl.replace('{deviceSecurityGroupName}', encodeURIComponent(deviceSecurityGroupName)); + 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 = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (deviceSecurityGroup !== null && deviceSecurityGroup !== undefined) { + let requestModelMapper = new client.models['DeviceSecurityGroup']().mapper(); + requestModel = client.serialize(requestModelMapper, deviceSecurityGroup, 'deviceSecurityGroup'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(deviceSecurityGroup, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + 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['DeviceSecurityGroup']().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); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DeviceSecurityGroup']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes the security group + * + * @param {string} resourceId The identifier of the resource. + * + * @param {string} deviceSecurityGroupName The name of the security group. + * Please notice that the name is case insensitive. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceId, deviceSecurityGroupName, 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-08-01-preview'; + // Validate + try { + if (resourceId === null || resourceId === undefined || typeof resourceId.valueOf() !== 'string') { + throw new Error('resourceId cannot be null or undefined and it must be of type string.'); + } + if (deviceSecurityGroupName === null || deviceSecurityGroupName === undefined || typeof deviceSecurityGroupName.valueOf() !== 'string') { + throw new Error('deviceSecurityGroupName 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('/') ? '' : '/') + '{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}'; + requestUrl = requestUrl.replace('{resourceId}', encodeURIComponent(resourceId)); + requestUrl = requestUrl.replace('{deviceSecurityGroupName}', encodeURIComponent(deviceSecurityGroupName)); + 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 = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets the list of device security groups for the specified IoT hub resource. + * + * @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 DeviceSecurityGroupList} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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['DeviceSecurityGroupList']().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 DeviceSecurityGroups. */ +class DeviceSecurityGroups { + /** + * Create a DeviceSecurityGroups. + * @param {SecurityCenter} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._listNext = _listNext; + } + + /** + * Gets the list of device security groups for the specified IoT hub resource. + * + * @param {string} resourceId The identifier of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the list of device security groups for the specified IoT hub resource. + * + * @param {string} resourceId The identifier of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {DeviceSecurityGroupList} - 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 DeviceSecurityGroupList} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceId, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceId, options, optionalCallback); + } + } + + /** + * Gets the device security group for the specified IoT hub resource. + * + * @param {string} resourceId The identifier of the resource. + * + * @param {string} deviceSecurityGroupName The name of the security group. + * Please notice that the name is case insensitive. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceId, deviceSecurityGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceId, deviceSecurityGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the device security group for the specified IoT hub resource. + * + * @param {string} resourceId The identifier of the resource. + * + * @param {string} deviceSecurityGroupName The name of the security group. + * Please notice that the name is case insensitive. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {DeviceSecurityGroup} - 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 DeviceSecurityGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceId, deviceSecurityGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceId, deviceSecurityGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceId, deviceSecurityGroupName, options, optionalCallback); + } + } + + /** + * Creates or updates the device security group on a specified IoT hub + * resource. + * + * @param {string} resourceId The identifier of the resource. + * + * @param {string} deviceSecurityGroupName The name of the security group. + * Please notice that the name is case insensitive. + * + * @param {object} deviceSecurityGroup Security group object. + * + * @param {array} [deviceSecurityGroup.thresholdRules] A list of threshold + * custom alert rules. + * + * @param {array} [deviceSecurityGroup.timeWindowRules] A list of time window + * custom alert rules. + * + * @param {array} [deviceSecurityGroup.allowlistRules] A list of allow-list + * custom alert rules. + * + * @param {array} [deviceSecurityGroup.denylistRules] A list of deny-list + * custom alert rules. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceId, deviceSecurityGroupName, deviceSecurityGroup, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceId, deviceSecurityGroupName, deviceSecurityGroup, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates or updates the device security group on a specified IoT hub + * resource. + * + * @param {string} resourceId The identifier of the resource. + * + * @param {string} deviceSecurityGroupName The name of the security group. + * Please notice that the name is case insensitive. + * + * @param {object} deviceSecurityGroup Security group object. + * + * @param {array} [deviceSecurityGroup.thresholdRules] A list of threshold + * custom alert rules. + * + * @param {array} [deviceSecurityGroup.timeWindowRules] A list of time window + * custom alert rules. + * + * @param {array} [deviceSecurityGroup.allowlistRules] A list of allow-list + * custom alert rules. + * + * @param {array} [deviceSecurityGroup.denylistRules] A list of deny-list + * custom alert rules. + * + * @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 {DeviceSecurityGroup} - 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 DeviceSecurityGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceId, deviceSecurityGroupName, deviceSecurityGroup, 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._createOrUpdate(resourceId, deviceSecurityGroupName, deviceSecurityGroup, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceId, deviceSecurityGroupName, deviceSecurityGroup, options, optionalCallback); + } + } + + /** + * Deletes the security group + * + * @param {string} resourceId The identifier of the resource. + * + * @param {string} deviceSecurityGroupName The name of the security group. + * Please notice that the name is case insensitive. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceId, deviceSecurityGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceId, deviceSecurityGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the security group + * + * @param {string} resourceId The identifier of the resource. + * + * @param {string} deviceSecurityGroupName The name of the security group. + * Please notice that the name is case insensitive. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceId, deviceSecurityGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceId, deviceSecurityGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceId, deviceSecurityGroupName, options, optionalCallback); + } + } + + /** + * Gets the list of device security groups for the specified IoT hub resource. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the list of device security groups for the specified IoT hub resource. + * + * @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 {DeviceSecurityGroupList} - 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 DeviceSecurityGroupList} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = DeviceSecurityGroups; diff --git a/lib/services/securityManagement/lib/operations/index.d.ts b/lib/services/securityManagement/lib/operations/index.d.ts index d44c48a383..aa3d3bf1ec 100644 --- a/lib/services/securityManagement/lib/operations/index.d.ts +++ b/lib/services/securityManagement/lib/operations/index.d.ts @@ -1831,6 +1831,341 @@ export interface AdvancedThreatProtection { create(resourceId: string, advancedThreatProtectionSetting: models.AdvancedThreatProtectionSetting, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } +/** + * @class + * DeviceSecurityGroups + * __NOTE__: An instance of this class is automatically created for an + * instance of the SecurityCenter. + */ +export interface DeviceSecurityGroups { + + + /** + * Gets the list of device security groups for the specified IoT hub resource. + * + * @param {string} resourceId The identifier of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the list of device security groups for the specified IoT hub resource. + * + * @param {string} resourceId The identifier of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {DeviceSecurityGroupList} - 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. + * + * {DeviceSecurityGroupList} [result] - The deserialized result object if an error did not occur. + * See {@link DeviceSecurityGroupList} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceId: string, callback: ServiceCallback): void; + list(resourceId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the device security group for the specified IoT hub resource. + * + * @param {string} resourceId The identifier of the resource. + * + * @param {string} deviceSecurityGroupName The name of the security group. + * Please notice that the name is case insensitive. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceId: string, deviceSecurityGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the device security group for the specified IoT hub resource. + * + * @param {string} resourceId The identifier of the resource. + * + * @param {string} deviceSecurityGroupName The name of the security group. + * Please notice that the name is case insensitive. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {DeviceSecurityGroup} - 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. + * + * {DeviceSecurityGroup} [result] - The deserialized result object if an error did not occur. + * See {@link DeviceSecurityGroup} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceId: string, deviceSecurityGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceId: string, deviceSecurityGroupName: string, callback: ServiceCallback): void; + get(resourceId: string, deviceSecurityGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates the device security group on a specified IoT hub + * resource. + * + * @param {string} resourceId The identifier of the resource. + * + * @param {string} deviceSecurityGroupName The name of the security group. + * Please notice that the name is case insensitive. + * + * @param {object} deviceSecurityGroup Security group object. + * + * @param {array} [deviceSecurityGroup.thresholdRules] A list of threshold + * custom alert rules. + * + * @param {array} [deviceSecurityGroup.timeWindowRules] A list of time window + * custom alert rules. + * + * @param {array} [deviceSecurityGroup.allowlistRules] A list of allow-list + * custom alert rules. + * + * @param {array} [deviceSecurityGroup.denylistRules] A list of deny-list + * custom alert rules. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceId: string, deviceSecurityGroupName: string, deviceSecurityGroup: models.DeviceSecurityGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates the device security group on a specified IoT hub + * resource. + * + * @param {string} resourceId The identifier of the resource. + * + * @param {string} deviceSecurityGroupName The name of the security group. + * Please notice that the name is case insensitive. + * + * @param {object} deviceSecurityGroup Security group object. + * + * @param {array} [deviceSecurityGroup.thresholdRules] A list of threshold + * custom alert rules. + * + * @param {array} [deviceSecurityGroup.timeWindowRules] A list of time window + * custom alert rules. + * + * @param {array} [deviceSecurityGroup.allowlistRules] A list of allow-list + * custom alert rules. + * + * @param {array} [deviceSecurityGroup.denylistRules] A list of deny-list + * custom alert rules. + * + * @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 {DeviceSecurityGroup} - 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. + * + * {DeviceSecurityGroup} [result] - The deserialized result object if an error did not occur. + * See {@link DeviceSecurityGroup} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceId: string, deviceSecurityGroupName: string, deviceSecurityGroup: models.DeviceSecurityGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceId: string, deviceSecurityGroupName: string, deviceSecurityGroup: models.DeviceSecurityGroup, callback: ServiceCallback): void; + createOrUpdate(resourceId: string, deviceSecurityGroupName: string, deviceSecurityGroup: models.DeviceSecurityGroup, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the security group + * + * @param {string} resourceId The identifier of the resource. + * + * @param {string} deviceSecurityGroupName The name of the security group. + * Please notice that the name is case insensitive. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceId: string, deviceSecurityGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the security group + * + * @param {string} resourceId The identifier of the resource. + * + * @param {string} deviceSecurityGroupName The name of the security group. + * Please notice that the name is case insensitive. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceId: string, deviceSecurityGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceId: string, deviceSecurityGroupName: string, callback: ServiceCallback): void; + deleteMethod(resourceId: string, deviceSecurityGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the list of device security groups for the specified IoT hub resource. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the list of device security groups for the specified IoT hub resource. + * + * @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 {DeviceSecurityGroupList} - 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. + * + * {DeviceSecurityGroupList} [result] - The deserialized result object if an error did not occur. + * See {@link DeviceSecurityGroupList} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + /** * @class * Settings @@ -1894,8 +2229,8 @@ export interface Settings { /** * Settings of different configurations in security center * - * @param {string} settingName Name of setting. Possible values include: - * 'MCAS', 'WDATP' + * @param {string} settingName Name of setting: (MCAS/WDATP). Possible values + * include: 'MCAS', 'WDATP' * * @param {object} [options] Optional Parameters. * @@ -1913,8 +2248,8 @@ export interface Settings { /** * Settings of different configurations in security center * - * @param {string} settingName Name of setting. Possible values include: - * 'MCAS', 'WDATP' + * @param {string} settingName Name of setting: (MCAS/WDATP). Possible values + * include: 'MCAS', 'WDATP' * * @param {object} [options] Optional Parameters. * @@ -1951,12 +2286,14 @@ export interface Settings { /** * updating settings about different configurations in security center * - * @param {string} settingName Name of setting. Possible values include: - * 'MCAS', 'WDATP' + * @param {string} settingName Name of setting: (MCAS/WDATP). Possible values + * include: 'MCAS', 'WDATP' * * @param {object} setting Setting object * - * @param {string} setting.kind Polymorphic Discriminator + * @param {string} setting.kind the kind of the settings string + * (DataExportSetting). Possible values include: 'DataExportSetting', + * 'AlertSuppressionSetting' * * @param {object} [options] Optional Parameters. * @@ -1974,12 +2311,14 @@ export interface Settings { /** * updating settings about different configurations in security center * - * @param {string} settingName Name of setting. Possible values include: - * 'MCAS', 'WDATP' + * @param {string} settingName Name of setting: (MCAS/WDATP). Possible values + * include: 'MCAS', 'WDATP' * * @param {object} setting Setting object * - * @param {string} setting.kind Polymorphic Discriminator + * @param {string} setting.kind the kind of the settings string + * (DataExportSetting). Possible values include: 'DataExportSetting', + * 'AlertSuppressionSetting' * * @param {object} [options] Optional Parameters. * diff --git a/lib/services/securityManagement/lib/operations/index.js b/lib/services/securityManagement/lib/operations/index.js index d14a107507..422ae61c28 100644 --- a/lib/services/securityManagement/lib/operations/index.js +++ b/lib/services/securityManagement/lib/operations/index.js @@ -20,6 +20,7 @@ exports.WorkspaceSettings = require('./workspaceSettings'); exports.AutoProvisioningSettings = require('./autoProvisioningSettings'); exports.Compliances = require('./compliances'); exports.AdvancedThreatProtection = require('./advancedThreatProtection'); +exports.DeviceSecurityGroups = require('./deviceSecurityGroups'); exports.Settings = require('./settings'); exports.InformationProtectionPolicies = require('./informationProtectionPolicies'); exports.Operations = require('./operations'); diff --git a/lib/services/securityManagement/lib/operations/iotSecurityGroups.js b/lib/services/securityManagement/lib/operations/iotSecurityGroups.js new file mode 100644 index 0000000000..5d4d3bf3de --- /dev/null +++ b/lib/services/securityManagement/lib/operations/iotSecurityGroups.js @@ -0,0 +1,989 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Gets the list of security groups for the specified IoT hub resource. + * + * @param {string} resourceId The identifier of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IotSecurityGroupList} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceId, 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-08-01-preview'; + // Validate + try { + if (resourceId === null || resourceId === undefined || typeof resourceId.valueOf() !== 'string') { + throw new Error('resourceId 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('/') ? '' : '/') + '{resourceId}/providers/Microsoft.Security/iotSecurityGroups'; + requestUrl = requestUrl.replace('{resourceId}', encodeURIComponent(resourceId)); + 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['IotSecurityGroupList']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets the security group for the specified IoT hub resource. + * + * @param {string} resourceId The identifier of the resource. + * + * @param {string} iotSecurityGroupName The name of the security group. Please + * notice that the name is case insensitive. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IotSecurityGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceId, iotSecurityGroupName, 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-08-01-preview'; + // Validate + try { + if (resourceId === null || resourceId === undefined || typeof resourceId.valueOf() !== 'string') { + throw new Error('resourceId cannot be null or undefined and it must be of type string.'); + } + if (iotSecurityGroupName === null || iotSecurityGroupName === undefined || typeof iotSecurityGroupName.valueOf() !== 'string') { + throw new Error('iotSecurityGroupName 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('/') ? '' : '/') + '{resourceId}/providers/Microsoft.Security/iotSecurityGroups/{iotSecurityGroupName}'; + requestUrl = requestUrl.replace('{resourceId}', encodeURIComponent(resourceId)); + requestUrl = requestUrl.replace('{iotSecurityGroupName}', encodeURIComponent(iotSecurityGroupName)); + 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['IotSecurityGroup']().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 the security group on a specified IoT hub resource. + * + * @param {string} resourceId The identifier of the resource. + * + * @param {string} iotSecurityGroupName The name of the security group. Please + * notice that the name is case insensitive. + * + * @param {object} iotSecurityGroup Security group object. + * + * @param {array} [iotSecurityGroup.thresholdRules] A list of threshold custom + * alert rules. + * + * @param {array} [iotSecurityGroup.timeWindowRules] A list of time window + * custom alert rules. + * + * @param {array} [iotSecurityGroup.allowlistRules] A list of allow-list custom + * alert rules. + * + * @param {array} [iotSecurityGroup.denylistRules] A list of deny-list custom + * alert rules. + * + * @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 IotSecurityGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceId, iotSecurityGroupName, iotSecurityGroup, 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-08-01-preview'; + // Validate + try { + if (resourceId === null || resourceId === undefined || typeof resourceId.valueOf() !== 'string') { + throw new Error('resourceId cannot be null or undefined and it must be of type string.'); + } + if (iotSecurityGroupName === null || iotSecurityGroupName === undefined || typeof iotSecurityGroupName.valueOf() !== 'string') { + throw new Error('iotSecurityGroupName cannot be null or undefined and it must be of type string.'); + } + if (iotSecurityGroup === null || iotSecurityGroup === undefined) { + throw new Error('iotSecurityGroup cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + '{resourceId}/providers/Microsoft.Security/iotSecurityGroups/{iotSecurityGroupName}'; + requestUrl = requestUrl.replace('{resourceId}', encodeURIComponent(resourceId)); + requestUrl = requestUrl.replace('{iotSecurityGroupName}', encodeURIComponent(iotSecurityGroupName)); + 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 = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (iotSecurityGroup !== null && iotSecurityGroup !== undefined) { + let requestModelMapper = new client.models['IotSecurityGroup']().mapper(); + requestModel = client.serialize(requestModelMapper, iotSecurityGroup, 'iotSecurityGroup'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(iotSecurityGroup, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + 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['IotSecurityGroup']().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); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['IotSecurityGroup']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes the security group + * + * @param {string} resourceId The identifier of the resource. + * + * @param {string} iotSecurityGroupName The name of the security group. Please + * notice that the name is case insensitive. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceId, iotSecurityGroupName, 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-08-01-preview'; + // Validate + try { + if (resourceId === null || resourceId === undefined || typeof resourceId.valueOf() !== 'string') { + throw new Error('resourceId cannot be null or undefined and it must be of type string.'); + } + if (iotSecurityGroupName === null || iotSecurityGroupName === undefined || typeof iotSecurityGroupName.valueOf() !== 'string') { + throw new Error('iotSecurityGroupName 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('/') ? '' : '/') + '{resourceId}/providers/Microsoft.Security/iotSecurityGroups/{iotSecurityGroupName}'; + requestUrl = requestUrl.replace('{resourceId}', encodeURIComponent(resourceId)); + requestUrl = requestUrl.replace('{iotSecurityGroupName}', encodeURIComponent(iotSecurityGroupName)); + 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 = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + 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; + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a IotSecurityGroups. */ +class IotSecurityGroups { + /** + * Create a IotSecurityGroups. + * @param {SecurityCenter} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + } + + /** + * Gets the list of security groups for the specified IoT hub resource. + * + * @param {string} resourceId The identifier of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the list of security groups for the specified IoT hub resource. + * + * @param {string} resourceId The identifier of the resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {IotSecurityGroupList} - 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 IotSecurityGroupList} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceId, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceId, options, optionalCallback); + } + } + + /** + * Gets the security group for the specified IoT hub resource. + * + * @param {string} resourceId The identifier of the resource. + * + * @param {string} iotSecurityGroupName The name of the security group. Please + * notice that the name is case insensitive. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceId, iotSecurityGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceId, iotSecurityGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the security group for the specified IoT hub resource. + * + * @param {string} resourceId The identifier of the resource. + * + * @param {string} iotSecurityGroupName The name of the security group. Please + * notice that the name is case insensitive. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {IotSecurityGroup} - 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 IotSecurityGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceId, iotSecurityGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceId, iotSecurityGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceId, iotSecurityGroupName, options, optionalCallback); + } + } + + /** + * Creates or updates the security group on a specified IoT hub resource. + * + * @param {string} resourceId The identifier of the resource. + * + * @param {string} iotSecurityGroupName The name of the security group. Please + * notice that the name is case insensitive. + * + * @param {object} iotSecurityGroup Security group object. + * + * @param {array} [iotSecurityGroup.thresholdRules] A list of threshold custom + * alert rules. + * + * @param {array} [iotSecurityGroup.timeWindowRules] A list of time window + * custom alert rules. + * + * @param {array} [iotSecurityGroup.allowlistRules] A list of allow-list custom + * alert rules. + * + * @param {array} [iotSecurityGroup.denylistRules] A list of deny-list custom + * alert rules. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceId, iotSecurityGroupName, iotSecurityGroup, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceId, iotSecurityGroupName, iotSecurityGroup, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates or updates the security group on a specified IoT hub resource. + * + * @param {string} resourceId The identifier of the resource. + * + * @param {string} iotSecurityGroupName The name of the security group. Please + * notice that the name is case insensitive. + * + * @param {object} iotSecurityGroup Security group object. + * + * @param {array} [iotSecurityGroup.thresholdRules] A list of threshold custom + * alert rules. + * + * @param {array} [iotSecurityGroup.timeWindowRules] A list of time window + * custom alert rules. + * + * @param {array} [iotSecurityGroup.allowlistRules] A list of allow-list custom + * alert rules. + * + * @param {array} [iotSecurityGroup.denylistRules] A list of deny-list custom + * alert rules. + * + * @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 {IotSecurityGroup} - 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 IotSecurityGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceId, iotSecurityGroupName, iotSecurityGroup, 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._createOrUpdate(resourceId, iotSecurityGroupName, iotSecurityGroup, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceId, iotSecurityGroupName, iotSecurityGroup, options, optionalCallback); + } + } + + /** + * Deletes the security group + * + * @param {string} resourceId The identifier of the resource. + * + * @param {string} iotSecurityGroupName The name of the security group. Please + * notice that the name is case insensitive. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceId, iotSecurityGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceId, iotSecurityGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the security group + * + * @param {string} resourceId The identifier of the resource. + * + * @param {string} iotSecurityGroupName The name of the security group. Please + * notice that the name is case insensitive. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceId, iotSecurityGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceId, iotSecurityGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceId, iotSecurityGroupName, options, optionalCallback); + } + } + +} + +module.exports = IotSecurityGroups; diff --git a/lib/services/securityManagement/lib/operations/settings.js b/lib/services/securityManagement/lib/operations/settings.js index 270ce5d708..c2d6aa6bc2 100644 --- a/lib/services/securityManagement/lib/operations/settings.js +++ b/lib/services/securityManagement/lib/operations/settings.js @@ -154,8 +154,8 @@ function _list(options, callback) { /** * Settings of different configurations in security center * - * @param {string} settingName Name of setting. Possible values include: - * 'MCAS', 'WDATP' + * @param {string} settingName Name of setting: (MCAS/WDATP). Possible values + * include: 'MCAS', 'WDATP' * * @param {object} [options] Optional Parameters. * @@ -298,12 +298,14 @@ function _get(settingName, options, callback) { /** * updating settings about different configurations in security center * - * @param {string} settingName Name of setting. Possible values include: - * 'MCAS', 'WDATP' + * @param {string} settingName Name of setting: (MCAS/WDATP). Possible values + * include: 'MCAS', 'WDATP' * * @param {object} setting Setting object * - * @param {string} setting.kind Polymorphic Discriminator + * @param {string} setting.kind the kind of the settings string + * (DataExportSetting). Possible values include: 'DataExportSetting', + * 'AlertSuppressionSetting' * * @param {object} [options] Optional Parameters. * @@ -348,9 +350,6 @@ function _update(settingName, setting, options, callback) { if (settingName === null || settingName === undefined || typeof settingName.valueOf() !== 'string') { throw new Error('settingName cannot be null or undefined and it must be of type string.'); } - if (setting === null || setting === undefined) { - throw new Error('setting cannot be null or undefined.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -682,8 +681,8 @@ class Settings { /** * Settings of different configurations in security center * - * @param {string} settingName Name of setting. Possible values include: - * 'MCAS', 'WDATP' + * @param {string} settingName Name of setting: (MCAS/WDATP). Possible values + * include: 'MCAS', 'WDATP' * * @param {object} [options] Optional Parameters. * @@ -713,8 +712,8 @@ class Settings { /** * Settings of different configurations in security center * - * @param {string} settingName Name of setting. Possible values include: - * 'MCAS', 'WDATP' + * @param {string} settingName Name of setting: (MCAS/WDATP). Possible values + * include: 'MCAS', 'WDATP' * * @param {object} [options] Optional Parameters. * @@ -766,12 +765,14 @@ class Settings { /** * updating settings about different configurations in security center * - * @param {string} settingName Name of setting. Possible values include: - * 'MCAS', 'WDATP' + * @param {string} settingName Name of setting: (MCAS/WDATP). Possible values + * include: 'MCAS', 'WDATP' * * @param {object} setting Setting object * - * @param {string} setting.kind Polymorphic Discriminator + * @param {string} setting.kind the kind of the settings string + * (DataExportSetting). Possible values include: 'DataExportSetting', + * 'AlertSuppressionSetting' * * @param {object} [options] Optional Parameters. * @@ -801,12 +802,14 @@ class Settings { /** * updating settings about different configurations in security center * - * @param {string} settingName Name of setting. Possible values include: - * 'MCAS', 'WDATP' + * @param {string} settingName Name of setting: (MCAS/WDATP). Possible values + * include: 'MCAS', 'WDATP' * * @param {object} setting Setting object * - * @param {string} setting.kind Polymorphic Discriminator + * @param {string} setting.kind the kind of the settings string + * (DataExportSetting). Possible values include: 'DataExportSetting', + * 'AlertSuppressionSetting' * * @param {object} [options] Optional Parameters. * diff --git a/lib/services/securityManagement/lib/securityCenter.d.ts b/lib/services/securityManagement/lib/securityCenter.d.ts index d229d77689..71d5f9471a 100644 --- a/lib/services/securityManagement/lib/securityCenter.d.ts +++ b/lib/services/securityManagement/lib/securityCenter.d.ts @@ -64,6 +64,7 @@ export default class SecurityCenter extends AzureServiceClient { autoProvisioningSettings: operations.AutoProvisioningSettings; compliances: operations.Compliances; advancedThreatProtection: operations.AdvancedThreatProtection; + deviceSecurityGroups: operations.DeviceSecurityGroups; settings: operations.Settings; informationProtectionPolicies: operations.InformationProtectionPolicies; operations: operations.Operations; diff --git a/lib/services/securityManagement/lib/securityCenter.js b/lib/services/securityManagement/lib/securityCenter.js index f5fb9130ac..b534108ce3 100644 --- a/lib/services/securityManagement/lib/securityCenter.js +++ b/lib/services/securityManagement/lib/securityCenter.js @@ -82,6 +82,7 @@ class SecurityCenter extends ServiceClient { this.autoProvisioningSettings = new operations.AutoProvisioningSettings(this); this.compliances = new operations.Compliances(this); this.advancedThreatProtection = new operations.AdvancedThreatProtection(this); + this.deviceSecurityGroups = new operations.DeviceSecurityGroups(this); this.settings = new operations.Settings(this); this.informationProtectionPolicies = new operations.InformationProtectionPolicies(this); this.operations = new operations.Operations(this);