public async Task SetTriggerProperty_ChannelAsync() { var triggerItem = NotificationTriggerItem.ThresholdTrigger(channel: "Backup State", parentId: "4000"); var channelItem = new ChannelItem(name: "Backup State"); var response = new NotificationTriggerResponse(new[] { triggerItem }, new[] { channelItem }); var client = Initialize_Client(response); var trigger = client.GetNotificationTriggers(4000).First(t => t.Type == TriggerType.Threshold); await ExecuteAsync( async c => { var channel = await c.GetChannelAsync(4000, 1); await c.SetTriggerPropertyAsync(trigger, TriggerProperty.Channel, channel); }, new[] { UnitRequest.Channels(4000), UnitRequest.ChannelProperties(4000, 1), UnitRequest.Sensors("filter_objid=4000"), UnitRequest.Channels(4000), UnitRequest.ChannelProperties(4000, 1), UnitRequest.EditSettings("id=4000&subid=7&channel_7=1") } ); }
private void Channel_SetValueLookup(object value, string url) { Execute( c => c.SetChannelProperty(1001, 1, ChannelProperty.ValueLookup, value), UnitRequest.EditSettings($"id=1001&valuelookup_1={url}") ); }
public async Task SetTriggerProperty_NormalAsync() { var trigger = GetTrigger(); await ExecuteAsync( async c => await c.SetTriggerPropertyAsync(trigger, TriggerProperty.Threshold, 20.0), UnitRequest.EditSettings("id=1&subid=7&threshold_7=20") ); }
public async Task SetTriggerProperty_NullNotificationActionAsync() { var trigger = GetTrigger(); await ExecuteAsync( async c => await c.SetTriggerPropertyAsync(trigger, TriggerProperty.OnNotificationAction, null), UnitRequest.EditSettings("id=1&subid=7&onnotificationid_7=-1%7CNone") ); }
public void SetTriggerProperty_NullNotificationAction() { var trigger = GetTrigger(); Execute( c => c.SetTriggerProperty(trigger, TriggerProperty.OnNotificationAction, null), UnitRequest.EditSettings("id=1&subid=7&onnotificationid_7=-1%7CNone") ); }
public void SetTriggerProperty_Normal() { var trigger = GetTrigger(); Execute( c => c.SetTriggerProperty(trigger, TriggerProperty.Threshold, 20.0), UnitRequest.EditSettings("id=1&subid=7&threshold_7=20") ); }
public void AddNotificationTrigger_TriggerChannel_StandardTriggerChannel_OnContainer() { var urls = new[] { UnitRequest.TriggerTypes(1001), //Validate Supported Triggers UnitRequest.Sensors("filter_objid=1001"), //Validate TriggerChannel target compatibility UnitRequest.EditSettings("id=1001&subid=new&onnotificationid_new=-1%7CNone&class=threshold&offnotificationid_new=-1%7CNone&channel_new=-1&condition_new=0&threshold_new=0&latency_new=60&objecttype=nodetrigger") //Add Trigger }; TestTriggerChannel(TriggerChannel.Total, urls, false); }
public void AddNotificationTrigger_TriggerChannel_ChannelId_OnSensor() { var urls = new[] { UnitRequest.TriggerTypes(1001), //Validate Supported Triggers UnitRequest.Sensors("filter_objid=1001"), //Validate TriggerChannel target compatibility UnitRequest.ChannelProperties(1001, 3), UnitRequest.EditSettings("id=1001&subid=new&onnotificationid_new=-1%7CNone&class=threshold&offnotificationid_new=-1%7CNone&channel_new=3&condition_new=0&threshold_new=0&latency_new=60&objecttype=nodetrigger") //Add Trigger }; TestTriggerChannel(new TriggerChannel(3), urls, true); }
public async Task SetTriggerProperty_MultipleParametersAsync() { var trigger = GetTrigger(); await ExecuteAsync( async c => await c.SetTriggerPropertyAsync(trigger, new TriggerParameter(TriggerProperty.Threshold, 20), new TriggerParameter(TriggerProperty.Latency, 30) ), UnitRequest.EditSettings("id=1&subid=7&threshold_7=20&latency_7=30") ); }
public void SetTriggerProperty_MultipleParameters() { var trigger = GetTrigger(); Execute( c => c.SetTriggerProperty(trigger, new TriggerParameter(TriggerProperty.Threshold, 20.1), new TriggerParameter(TriggerProperty.Latency, 30) ), UnitRequest.EditSettings("id=1&subid=7&threshold_7=20.1&latency_7=30") ); }
public async Task SetTriggerProperty_NotificationActionAsync() { var trigger = GetTrigger(); var client = Initialize_Client(new MultiTypeResponse()); var action = client.GetNotificationActions().First(); await ExecuteAsync( async c => await c.SetTriggerPropertyAsync(trigger, TriggerProperty.OnNotificationAction, action), UnitRequest.EditSettings("id=1&subid=7&onnotificationid_7=300%7CEmail+and+push+notification+to+admin") ); }
public void AddNotificationTrigger_TriggerChannel_Channel_WithStandardTriggerChannelName_OnSensor() { var urls = new[] { UnitRequest.TriggerTypes(1001), //Validate Supported Triggers UnitRequest.Sensors("filter_objid=1001"), //Validate TriggerChannel target compatibility UnitRequest.Channels(1001), UnitRequest.ChannelProperties(1001, 1), UnitRequest.EditSettings("id=1001&subid=new&onnotificationid_new=-1%7CNone&class=threshold&offnotificationid_new=-1%7CNone&channel_new=1&condition_new=0&threshold_new=0&latency_new=60&objecttype=nodetrigger") //Add Trigger }; var channel = new Channel { Name = "Total", Id = 1 }; TestTriggerChannel(channel, urls, true, new ChannelItem(name: "Total", objId: "1")); }