public async Task <bool> IsRuleSetTo(string resourceGroupName, string nsgName, string ruleName, RuleAction action, CancellationToken cancellationToken = default) { var nsg = await _azure.NetworkSecurityGroups.GetByResourceGroupAsync(resourceGroupName, nsgName, cancellationToken); foreach (var curRuleKvp in nsg.SecurityRules) { if (curRuleKvp.Value.Name == ruleName) { //TODO: VERIFY CHECK if (curRuleKvp.Value.Access.ToLower() == action.ToString().ToLower()) { return(true); } } } return(false); }
public void ModelsToString() { var facts = new Facts() { StringFact = "abc" }; Assert.Equal("{\"stringFact\":\"abc\"}", facts.ToString()); var action = new RuleAction() { Type = RuleAction.ActionType.Field, Id = "Field1" }; Assert.Equal("Field Field1", action.ToString()); var condition = new Condition() { Id = "id", Op = Condition.Oper.LessThanOrEqual, Value = new IntValue(1) }; Assert.Equal("id LessThanOrEqual 1", condition.ToString()); }