예제 #1
0
 public static SecurityGroup WithSecurityGroupRule(this SecurityGroup group, SecurityGroupRule rule)
 {
     if (rule is IngressRule)
     {
         group.AddIngressRule(rule.Peer, rule.Port, rule.Description, rule.RemoteRule);
     }
     else if (rule is EgressRule)
     {
         group.AddEgressRule(rule.Peer, rule.Port, rule.Description, rule.RemoteRule);
     }
     else
     {
         throw new SecurityGroupRuleException(rule);
     }
     return(group);
 }
예제 #2
0
 public SecurityGroupRuleException(SecurityGroupRule rule) : base($"SecurityGroup rule {rule.GetType().Name} ({rule.Peer}, {rule.Port}: {rule.Description}) is not expected")
 {
 }