Share via


NsgSecurityRule Class

  • java.lang.Object
    • com.azure.resourcemanager.resourcemover.models.NsgSecurityRule

Implements

public final class NsgSecurityRule
implements JsonSerializable<NsgSecurityRule>

Security Rule data model for Network Security Groups.

Constructor Summary

Constructor Description
NsgSecurityRule()

Creates an instance of NsgSecurityRule class.

Method Summary

Modifier and Type Method and Description
String access()

Get the access property: Gets or sets whether network traffic is allowed or denied.

String description()

Get the description property: Gets or sets a description for this rule.

String destinationAddressPrefix()

Get the destinationAddressPrefix property: Gets or sets destination address prefix.

String destinationPortRange()

Get the destinationPortRange property: Gets or sets Destination Port or Range.

String direction()

Get the direction property: Gets or sets the direction of the rule.InBound or Outbound.

static NsgSecurityRule fromJson(JsonReader jsonReader)

Reads an instance of NsgSecurityRule from the JsonReader.

String name()

Get the name property: Gets or sets the Security rule name.

Integer priority()

Get the priority property: Gets or sets the priority of the rule.

String protocol()

Get the protocol property: Gets or sets Network protocol this rule applies to.

String sourceAddressPrefix()

Get the sourceAddressPrefix property: Gets or sets source address prefix.

String sourcePortRange()

Get the sourcePortRange property: Gets or sets Source Port or Range.

JsonWriter toJson(JsonWriter jsonWriter)
void validate()

Validates the instance.

NsgSecurityRule withAccess(String access)

Set the access property: Gets or sets whether network traffic is allowed or denied.

NsgSecurityRule withDescription(String description)

Set the description property: Gets or sets a description for this rule.

NsgSecurityRule withDestinationAddressPrefix(String destinationAddressPrefix)

Set the destinationAddressPrefix property: Gets or sets destination address prefix.

NsgSecurityRule withDestinationPortRange(String destinationPortRange)

Set the destinationPortRange property: Gets or sets Destination Port or Range.

NsgSecurityRule withDirection(String direction)

Set the direction property: Gets or sets the direction of the rule.InBound or Outbound.

NsgSecurityRule withName(String name)

Set the name property: Gets or sets the Security rule name.

NsgSecurityRule withPriority(Integer priority)

Set the priority property: Gets or sets the priority of the rule.

NsgSecurityRule withProtocol(String protocol)

Set the protocol property: Gets or sets Network protocol this rule applies to.

NsgSecurityRule withSourceAddressPrefix(String sourceAddressPrefix)

Set the sourceAddressPrefix property: Gets or sets source address prefix.

NsgSecurityRule withSourcePortRange(String sourcePortRange)

Set the sourcePortRange property: Gets or sets Source Port or Range.

Methods inherited from java.lang.Object

Constructor Details

NsgSecurityRule

public NsgSecurityRule()

Creates an instance of NsgSecurityRule class.

Method Details

access

public String access()

Get the access property: Gets or sets whether network traffic is allowed or denied. Possible values are “Allow” and “Deny”.

Returns:

the access value.

description

public String description()

Get the description property: Gets or sets a description for this rule. Restricted to 140 chars.

Returns:

the description value.

destinationAddressPrefix

public String destinationAddressPrefix()

Get the destinationAddressPrefix property: Gets or sets destination address prefix. CIDR or source IP range. A “*” can also be used to match all source IPs. Default tags such as ‘VirtualNetwork’, ‘AzureLoadBalancer’ and ‘Internet’ can also be used.

Returns:

the destinationAddressPrefix value.

destinationPortRange

public String destinationPortRange()

Get the destinationPortRange property: Gets or sets Destination Port or Range. Integer or range between 0 and 65535. A “*” can also be used to match all ports.

Returns:

the destinationPortRange value.

direction

public String direction()

Get the direction property: Gets or sets the direction of the rule.InBound or Outbound. The direction specifies if rule will be evaluated on incoming or outgoing traffic.

Returns:

the direction value.

fromJson

public static NsgSecurityRule fromJson(JsonReader jsonReader)

Reads an instance of NsgSecurityRule from the JsonReader.

Parameters:

jsonReader - The JsonReader being read.

Returns:

An instance of NsgSecurityRule if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.

Throws:

IOException

- If an error occurs while reading the NsgSecurityRule.

name

public String name()

Get the name property: Gets or sets the Security rule name.

Returns:

the name value.

priority

public Integer priority()

Get the priority property: Gets or sets the priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule.

Returns:

the priority value.

protocol

public String protocol()

Get the protocol property: Gets or sets Network protocol this rule applies to. Can be Tcp, Udp or All(*).

Returns:

the protocol value.

sourceAddressPrefix

public String sourceAddressPrefix()

Get the sourceAddressPrefix property: Gets or sets source address prefix. CIDR or source IP range. A “*” can also be used to match all source IPs. Default tags such as ‘VirtualNetwork’, ‘AzureLoadBalancer’ and ‘Internet’ can also be used. If this is an ingress rule, specifies where network traffic originates from.

Returns:

the sourceAddressPrefix value.

sourcePortRange

public String sourcePortRange()

Get the sourcePortRange property: Gets or sets Source Port or Range. Integer or range between 0 and 65535. A “*” can also be used to match all ports.

Returns:

the sourcePortRange value.

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

validate

public void validate()

Validates the instance.

withAccess

public NsgSecurityRule withAccess(String access)

Set the access property: Gets or sets whether network traffic is allowed or denied. Possible values are “Allow” and “Deny”.

Parameters:

access - the access value to set.

Returns:

the NsgSecurityRule object itself.

withDescription

public NsgSecurityRule withDescription(String description)

Set the description property: Gets or sets a description for this rule. Restricted to 140 chars.

Parameters:

description - the description value to set.

Returns:

the NsgSecurityRule object itself.

withDestinationAddressPrefix

public NsgSecurityRule withDestinationAddressPrefix(String destinationAddressPrefix)

Set the destinationAddressPrefix property: Gets or sets destination address prefix. CIDR or source IP range. A “*” can also be used to match all source IPs. Default tags such as ‘VirtualNetwork’, ‘AzureLoadBalancer’ and ‘Internet’ can also be used.

Parameters:

destinationAddressPrefix - the destinationAddressPrefix value to set.

Returns:

the NsgSecurityRule object itself.

withDestinationPortRange

public NsgSecurityRule withDestinationPortRange(String destinationPortRange)

Set the destinationPortRange property: Gets or sets Destination Port or Range. Integer or range between 0 and 65535. A “*” can also be used to match all ports.

Parameters:

destinationPortRange - the destinationPortRange value to set.

Returns:

the NsgSecurityRule object itself.

withDirection

public NsgSecurityRule withDirection(String direction)

Set the direction property: Gets or sets the direction of the rule.InBound or Outbound. The direction specifies if rule will be evaluated on incoming or outgoing traffic.

Parameters:

direction - the direction value to set.

Returns:

the NsgSecurityRule object itself.

withName

public NsgSecurityRule withName(String name)

Set the name property: Gets or sets the Security rule name.

Parameters:

name - the name value to set.

Returns:

the NsgSecurityRule object itself.

withPriority

public NsgSecurityRule withPriority(Integer priority)

Set the priority property: Gets or sets the priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule.

Parameters:

priority - the priority value to set.

Returns:

the NsgSecurityRule object itself.

withProtocol

public NsgSecurityRule withProtocol(String protocol)

Set the protocol property: Gets or sets Network protocol this rule applies to. Can be Tcp, Udp or All(*).

Parameters:

protocol - the protocol value to set.

Returns:

the NsgSecurityRule object itself.

withSourceAddressPrefix

public NsgSecurityRule withSourceAddressPrefix(String sourceAddressPrefix)

Set the sourceAddressPrefix property: Gets or sets source address prefix. CIDR or source IP range. A “*” can also be used to match all source IPs. Default tags such as ‘VirtualNetwork’, ‘AzureLoadBalancer’ and ‘Internet’ can also be used. If this is an ingress rule, specifies where network traffic originates from.

Parameters:

sourceAddressPrefix - the sourceAddressPrefix value to set.

Returns:

the NsgSecurityRule object itself.

withSourcePortRange

public NsgSecurityRule withSourcePortRange(String sourcePortRange)

Set the sourcePortRange property: Gets or sets Source Port or Range. Integer or range between 0 and 65535. A “*” can also be used to match all ports.

Parameters:

sourcePortRange - the sourcePortRange value to set.

Returns:

the NsgSecurityRule object itself.

Applies to