UNPKG

@azure/arm-security

Version:
42 lines 2.1 kB
/* * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ import { __awaiter } from "tslib"; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. import { SecurityCenter } from "@azure/arm-security"; import { DefaultAzureCredential } from "@azure/identity"; /** * This sample demonstrates how to Use this method to creates or updates the device security group on a specified IoT Hub resource. * * @summary Use this method to creates or updates the device security group on a specified IoT Hub resource. * x-ms-original-file: specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/DeviceSecurityGroups/PutDeviceSecurityGroups_example.json */ function createOrUpdateADeviceSecurityGroupForTheSpecifiedIoTHubResource() { return __awaiter(this, void 0, void 0, function* () { const subscriptionId = "00000000-0000-0000-0000-000000000000"; const resourceId = "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Devices/iotHubs/sampleiothub"; const deviceSecurityGroupName = "samplesecuritygroup"; const deviceSecurityGroup = { timeWindowRules: [ { isEnabled: true, maxThreshold: 30, minThreshold: 0, ruleType: "ActiveConnectionsNotInAllowedRange", timeWindowSize: "PT05M" } ] }; const credential = new DefaultAzureCredential(); const client = new SecurityCenter(credential, subscriptionId); const result = yield client.deviceSecurityGroups.createOrUpdate(resourceId, deviceSecurityGroupName, deviceSecurityGroup); console.log(result); }); } createOrUpdateADeviceSecurityGroupForTheSpecifiedIoTHubResource().catch(console.error); //# sourceMappingURL=deviceSecurityGroupsCreateOrUpdateSample.js.map