Class AddressRule
Used to whitelist or blacklist an IP address or subnet within a cluster's IngressRules or EgressAddressRules.
note
This is currently supported only for clusters hosted on Azure. AWS doesn't support this scenario and we currently don't support automatic router configuration for on-premise environments.
Namespace: Neon.Kube.ClusterDef
Assembly: Neon.Kube.dll
Syntax
public class AddressRule
Constructors
AddressRule()
Default constructor.
Declaration
public AddressRule()
AddressRule(string, AddressRuleAction)
Constructor.
Declaration
public AddressRule(string addressOrSubnet, AddressRuleAction action)
Parameters
Type | Name | Description |
---|---|---|
string | addressOrSubnet | Specifies the IP address or subnet or you may also specify "any" to specify all possible IP addresses. |
AddressRuleAction | action | Specifies whether network traffic is to be allowed or denied. |
Properties
Action
Returns the action to performed for network traffic to/from the address or subnet.
Declaration
[JsonProperty(PropertyName = "Action", Required = Required.Always)]
[YamlMember(Alias = "action", ApplyNamingConventions = false)]
public AddressRuleAction Action { get; }
Property Value
Type | Description |
---|---|
AddressRuleAction |
AddressOrSubnet
Returns the specified IP address or subnet or "any" or null
for all possible IP addresses.
Declaration
[JsonProperty(PropertyName = "AddressOrSubnet", Required = Required.AllowNull)]
[YamlMember(Alias = "addressOrSubnet", ApplyNamingConventions = false)]
public string AddressOrSubnet { get; }
Property Value
Type | Description |
---|---|
string |
AllowAll
Returns an AddressRule that allows network traffic to/from all IP addresses.
Declaration
public static AddressRule AllowAll { get; }
Property Value
Type | Description |
---|---|
AddressRule |
DenyAll
Returns an AddressRule that denies network traffic to/from all IP addresses.
Declaration
public static AddressRule DenyAll { get; }
Property Value
Type | Description |
---|---|
AddressRule |
IsAny
Returns true
when the all possible IP addresses were specified.
Declaration
[JsonIgnore]
[YamlIgnore]
public bool IsAny { get; }
Property Value
Type | Description |
---|---|
bool |
Methods
Validate(ClusterDefinition, string)
Validates the address rule.
Declaration
public void Validate(ClusterDefinition clusterDefinition, string context)
Parameters
Type | Name | Description |
---|---|---|
ClusterDefinition | clusterDefinition | The cluster definition. |
string | context | Indicates where the address rule is specified, like: ingress-rule-address or egress-address. |
Exceptions
Type | Condition |
---|---|
ClusterDefinitionException | Thrown for an invalid rule. |