SecurityRule¶
-
class
oci.core.models.
SecurityRule
(**kwargs)¶ Bases:
object
A security rule is one of the items in a
NetworkSecurityGroup
. It is a virtual firewall rule for the VNICs in the network security group. A rule can be for either inbound (`direction`= INGRESS) or outbound (`direction`= EGRESS) IP packets.Attributes
DESTINATION_TYPE_CIDR_BLOCK
A constant which can be used with the destination_type property of a SecurityRule. DESTINATION_TYPE_NETWORK_SECURITY_GROUP
A constant which can be used with the destination_type property of a SecurityRule. DESTINATION_TYPE_SERVICE_CIDR_BLOCK
A constant which can be used with the destination_type property of a SecurityRule. DIRECTION_EGRESS
A constant which can be used with the direction property of a SecurityRule. DIRECTION_INGRESS
A constant which can be used with the direction property of a SecurityRule. SOURCE_TYPE_CIDR_BLOCK
A constant which can be used with the source_type property of a SecurityRule. SOURCE_TYPE_NETWORK_SECURITY_GROUP
A constant which can be used with the source_type property of a SecurityRule. SOURCE_TYPE_SERVICE_CIDR_BLOCK
A constant which can be used with the source_type property of a SecurityRule. description
Gets the description of this SecurityRule. destination
Gets the destination of this SecurityRule. destination_type
Gets the destination_type of this SecurityRule. direction
[Required] Gets the direction of this SecurityRule. icmp_options
Gets the icmp_options of this SecurityRule. id
Gets the id of this SecurityRule. is_stateless
Gets the is_stateless of this SecurityRule. is_valid
Gets the is_valid of this SecurityRule. protocol
[Required] Gets the protocol of this SecurityRule. source
Gets the source of this SecurityRule. source_type
Gets the source_type of this SecurityRule. tcp_options
Gets the tcp_options of this SecurityRule. time_created
Gets the time_created of this SecurityRule. udp_options
Gets the udp_options of this SecurityRule. Methods
__init__
(**kwargs)Initializes a new SecurityRule object with values from keyword arguments. -
DESTINATION_TYPE_CIDR_BLOCK
= 'CIDR_BLOCK'¶ A constant which can be used with the destination_type property of a SecurityRule. This constant has a value of “CIDR_BLOCK”
-
DESTINATION_TYPE_NETWORK_SECURITY_GROUP
= 'NETWORK_SECURITY_GROUP'¶ A constant which can be used with the destination_type property of a SecurityRule. This constant has a value of “NETWORK_SECURITY_GROUP”
-
DESTINATION_TYPE_SERVICE_CIDR_BLOCK
= 'SERVICE_CIDR_BLOCK'¶ A constant which can be used with the destination_type property of a SecurityRule. This constant has a value of “SERVICE_CIDR_BLOCK”
-
DIRECTION_EGRESS
= 'EGRESS'¶ A constant which can be used with the direction property of a SecurityRule. This constant has a value of “EGRESS”
-
DIRECTION_INGRESS
= 'INGRESS'¶ A constant which can be used with the direction property of a SecurityRule. This constant has a value of “INGRESS”
-
SOURCE_TYPE_CIDR_BLOCK
= 'CIDR_BLOCK'¶ A constant which can be used with the source_type property of a SecurityRule. This constant has a value of “CIDR_BLOCK”
-
SOURCE_TYPE_NETWORK_SECURITY_GROUP
= 'NETWORK_SECURITY_GROUP'¶ A constant which can be used with the source_type property of a SecurityRule. This constant has a value of “NETWORK_SECURITY_GROUP”
-
SOURCE_TYPE_SERVICE_CIDR_BLOCK
= 'SERVICE_CIDR_BLOCK'¶ A constant which can be used with the source_type property of a SecurityRule. This constant has a value of “SERVICE_CIDR_BLOCK”
-
__init__
(**kwargs)¶ Initializes a new SecurityRule object with values from keyword arguments. The following keyword arguments are supported (corresponding to the getters/setters of this class):
Parameters: - description (str) – The value to assign to the description property of this SecurityRule.
- destination (str) – The value to assign to the destination property of this SecurityRule.
- destination_type (str) – The value to assign to the destination_type property of this SecurityRule. Allowed values for this property are: “CIDR_BLOCK”, “SERVICE_CIDR_BLOCK”, “NETWORK_SECURITY_GROUP”, ‘UNKNOWN_ENUM_VALUE’. Any unrecognized values returned by a service will be mapped to ‘UNKNOWN_ENUM_VALUE’.
- direction (str) – The value to assign to the direction property of this SecurityRule. Allowed values for this property are: “EGRESS”, “INGRESS”, ‘UNKNOWN_ENUM_VALUE’. Any unrecognized values returned by a service will be mapped to ‘UNKNOWN_ENUM_VALUE’.
- icmp_options (oci.core.models.IcmpOptions) – The value to assign to the icmp_options property of this SecurityRule.
- id (str) – The value to assign to the id property of this SecurityRule.
- is_stateless (bool) – The value to assign to the is_stateless property of this SecurityRule.
- is_valid (bool) – The value to assign to the is_valid property of this SecurityRule.
- protocol (str) – The value to assign to the protocol property of this SecurityRule.
- source (str) – The value to assign to the source property of this SecurityRule.
- source_type (str) – The value to assign to the source_type property of this SecurityRule. Allowed values for this property are: “CIDR_BLOCK”, “SERVICE_CIDR_BLOCK”, “NETWORK_SECURITY_GROUP”, ‘UNKNOWN_ENUM_VALUE’. Any unrecognized values returned by a service will be mapped to ‘UNKNOWN_ENUM_VALUE’.
- tcp_options (oci.core.models.TcpOptions) – The value to assign to the tcp_options property of this SecurityRule.
- time_created (datetime) – The value to assign to the time_created property of this SecurityRule.
- udp_options (oci.core.models.UdpOptions) – The value to assign to the udp_options property of this SecurityRule.
-
description
¶ Gets the description of this SecurityRule. An optional description of your choice for the rule.
Returns: The description of this SecurityRule. Return type: str
-
destination
¶ Gets the destination of this SecurityRule. Conceptually, this is the range of IP addresses that a packet originating from the instance can go to.
Allowed values:
- An IP address range in CIDR notation. For example: 192.168.1.0/24 or 2001:0db8:0123:45::/56 IPv6 addressing is supported for all commercial and government regions. See IPv6 Addresses.
- The cidrBlock value for a
Service
, if you’re setting up a security rule for traffic destined for a particular Service through a service gateway. For example: oci-phx-objectstorage. - The OCID of a
NetworkSecurityGroup
in the same VCN. The value can be the NSG that the rule belongs to if the rule’s intent is to control traffic between VNICs in the same NSG.
Returns: The destination of this SecurityRule. Return type: str
-
destination_type
¶ Gets the destination_type of this SecurityRule. Type of destination for the rule. Required if direction = EGRESS.
Allowed values:
- CIDR_BLOCK: If the rule’s destination is an IP address range in CIDR notation.
- SERVICE_CIDR_BLOCK: If the rule’s destination is the cidrBlock value for a
Service
(the rule is for traffic destined for a particular Service through a service gateway). - NETWORK_SECURITY_GROUP: If the rule’s destination is the OCID of a
NetworkSecurityGroup
.
Allowed values for this property are: “CIDR_BLOCK”, “SERVICE_CIDR_BLOCK”, “NETWORK_SECURITY_GROUP”, ‘UNKNOWN_ENUM_VALUE’. Any unrecognized values returned by a service will be mapped to ‘UNKNOWN_ENUM_VALUE’.
Returns: The destination_type of this SecurityRule. Return type: str
-
direction
¶ [Required] Gets the direction of this SecurityRule. Direction of the security rule. Set to EGRESS for rules to allow outbound IP packets, or INGRESS for rules to allow inbound IP packets.
Allowed values for this property are: “EGRESS”, “INGRESS”, ‘UNKNOWN_ENUM_VALUE’. Any unrecognized values returned by a service will be mapped to ‘UNKNOWN_ENUM_VALUE’.
Returns: The direction of this SecurityRule. Return type: str
-
icmp_options
¶ Gets the icmp_options of this SecurityRule.
Returns: The icmp_options of this SecurityRule. Return type: oci.core.models.IcmpOptions
-
id
¶ Gets the id of this SecurityRule. An Oracle-assigned identifier for the security rule. You specify this ID when you want to update or delete the rule.
Example: 04ABEC
Returns: The id of this SecurityRule. Return type: str
-
is_stateless
¶ Gets the is_stateless of this SecurityRule. A stateless rule allows traffic in one direction. Remember to add a corresponding stateless rule in the other direction if you need to support bidirectional traffic. For example, if egress traffic allows TCP destination port 80, there should be an ingress rule to allow TCP source port 80. Defaults to false, which means the rule is stateful and a corresponding rule is not necessary for bidirectional traffic.
Returns: The is_stateless of this SecurityRule. Return type: bool
-
is_valid
¶ Gets the is_valid of this SecurityRule. Whether the rule is valid. The value is True when the rule is first created. If the rule’s source or destination is a network security group, the value changes to False if that network security group is deleted.
Returns: The is_valid of this SecurityRule. Return type: bool
-
protocol
¶ [Required] Gets the protocol of this SecurityRule. The transport protocol. Specify either all or an IPv4 protocol number as defined in Protocol Numbers. Options are supported only for ICMP (“1”), TCP (“6”), UDP (“17”), and ICMPv6 (“58”).
Returns: The protocol of this SecurityRule. Return type: str
-
source
¶ Gets the source of this SecurityRule. Conceptually, this is the range of IP addresses that a packet coming into the instance can come from.
Allowed values:
- An IP address range in CIDR notation. For example: 192.168.1.0/24 or 2001:0db8:0123:45::/56 IPv6 addressing is supported for all commercial and government regions. See IPv6 Addresses.
- The cidrBlock value for a
Service
, if you’re setting up a security rule for traffic coming from a particular Service through a service gateway. For example: oci-phx-objectstorage. - The OCID of a
NetworkSecurityGroup
in the same VCN. The value can be the NSG that the rule belongs to if the rule’s intent is to control traffic between VNICs in the same NSG.
Returns: The source of this SecurityRule. Return type: str
-
source_type
¶ Gets the source_type of this SecurityRule. Type of source for the rule. Required if direction = INGRESS.
- CIDR_BLOCK: If the rule’s source is an IP address range in CIDR notation.
- SERVICE_CIDR_BLOCK: If the rule’s source is the cidrBlock value for a
Service
(the rule is for traffic coming from a particular Service through a service gateway). - NETWORK_SECURITY_GROUP: If the rule’s source is the OCID of a
NetworkSecurityGroup
.
Allowed values for this property are: “CIDR_BLOCK”, “SERVICE_CIDR_BLOCK”, “NETWORK_SECURITY_GROUP”, ‘UNKNOWN_ENUM_VALUE’. Any unrecognized values returned by a service will be mapped to ‘UNKNOWN_ENUM_VALUE’.
Returns: The source_type of this SecurityRule. Return type: str
-
tcp_options
¶ Gets the tcp_options of this SecurityRule.
Returns: The tcp_options of this SecurityRule. Return type: oci.core.models.TcpOptions
-
time_created
¶ Gets the time_created of this SecurityRule. The date and time the security rule was created. Format defined by RFC3339.
Returns: The time_created of this SecurityRule. Return type: datetime
-
udp_options
¶ Gets the udp_options of this SecurityRule.
Returns: The udp_options of this SecurityRule. Return type: oci.core.models.UdpOptions
-