Add Network Security Group Security Rules
post
/20160918/networkSecurityGroups/{network_security_group_id}/actions/addSecurityRules
Add one or more security rules to the specified network security group.
Request
Supported Media Types
- application/json
Path Parameters
-
networkSecurityGroupId(required): string
Minimum Length:
1
Maximum Length:255
The OCID of the network security group.
Request with one or more security rules to be associated with the network security group.
Root Schema : AddNetworkSecurityGroupSecurityRulesDetails
Type:
Show Source
object
-
securityRules:
array securityRules
Minimum Number of Items:
1
Maximum Number of Items:25
An array of security rules to add to the NSG. You can add up to 25 rules in a single `AddNetworkSecurityGroupSecurityRules` operation. Adding more than 25 rules requires multiple operations.
Nested Schema : securityRules
Type:
array
Minimum Number of Items:
1
Maximum Number of Items:
25
An array of security rules to add to the NSG. You can add up to 25 rules in a single `AddNetworkSecurityGroupSecurityRules` operation. Adding more than 25 rules requires multiple operations.
Show Source
-
Array of:
object AddSecurityRuleDetails
A rule for allowing inbound (INGRESS) or outbound (EGRESS) IP packets.
Nested Schema : AddSecurityRuleDetails
Type:
object
A rule for allowing inbound (INGRESS) or outbound (EGRESS) IP packets.
Show Source
-
description:
string
Minimum Length:
1
Maximum Length:255
An optional description of your choice for the rule. Avoid entering confidential information. -
destination:
string
This is the range of IP addresses that a packet originating from the instance can go to. The following values are allowed:
- An IP address range in CIDR notation. For example: 192.168.1.0/24 or 2001:0db8:0123:45::/56
- 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.
- 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.
-
destinationType:
string
Allowed Values:
[ "CIDR_BLOCK", "SERVICE_CIDR_BLOCK", "NETWORK_SECURITY_GROUP" ]
Type of destination for the rule. This value is required if direction = EGRESS. The following values are allowed:- 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.
-
direction(required):
string
Allowed Values:
[ "EGRESS", "INGRESS" ]
Direction of the security rule. Set to EGRESS for rules to allow outbound IP packets, or INGRESS for rules to allow inbound IP packets. -
icmpOptions:
object IcmpOptions
Optional and valid only for ICMP and ICMPv6. Use to specify a particular ICMP type and code as defined in: - [ICMP Parameters](http://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml) - [ICMPv6 Parameters](https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml) If you specify ICMP or ICMPv6 as the protocol but omit this object, then all ICMP types and codes are allowed. If you do provide this object, the type is required and the code is optional. To enable MTU negotiation for ingress internet traffic via IPv4, make sure to allow type 3 ("Destination Unreachable") code 4 ("Fragmentation Needed and Don't Fragment was Set"). If you need to specify multiple codes for a single type, create a separate security list rule for each.
-
isStateless:
boolean
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. The default value is false, which means the rule is stateful and a corresponding rule is not necessary for bidirectional traffic.
-
protocol(required):
string
The transport protocol. Specify either all or one of the following IPv4 protocol numbers: 1 - ICMP, 6 - TCP, 17 - UDP, and 58 - ICMPv6.
-
source:
string
This is the range of IP addresses that a packet coming into the instance can come from. The following values are allowed:
- An IP address range in CIDR notation. For example: 192.168.1.0/24 or 2001:0db8:0123:45::/56
- 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.
- 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.
-
sourceType:
string
Allowed Values:
[ "CIDR_BLOCK", "SERVICE_CIDR_BLOCK", "NETWORK_SECURITY_GROUP" ]
Type of source for the rule. This value is 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.
-
tcpOptions:
object TcpOptions
Optional and valid only for TCP. Use to specify particular destination ports for TCP rules. If you specify TCP as the protocol but omit this object, then all destination ports are allowed.
-
udpOptions:
object UdpOptions
Optional and valid only for UDP. Use to specify particular destination ports for UDP rules. If you specify UDP as the protocol but omit this object, then all destination ports are allowed.
Nested Schema : IcmpOptions
Type:
object
Optional and valid only for ICMP and ICMPv6. Use to specify a particular ICMP type and code as defined in: - [ICMP Parameters](http://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml) - [ICMPv6 Parameters](https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml) If you specify ICMP or ICMPv6 as the protocol but omit this object, then all ICMP types and codes are allowed. If you do provide this object, the type is required and the code is optional. To enable MTU negotiation for ingress internet traffic via IPv4, make sure to allow type 3 ("Destination Unreachable") code 4 ("Fragmentation Needed and Don't Fragment was Set"). If you need to specify multiple codes for a single type, create a separate security list rule for each.
Show Source
-
code:
integer
Minimum Value:
0
Maximum Value:16
The ICMP code (optional). -
type(required):
integer
Minimum Value:
0
Maximum Value:254
The ICMP type.
Nested Schema : TcpOptions
Type:
object
Optional and valid only for TCP. Use to specify particular destination ports for TCP rules. If you specify TCP as the protocol but omit this object, then all destination ports are allowed.
Show Source
Nested Schema : UdpOptions
Type:
object
Optional and valid only for UDP. Use to specify particular destination ports for UDP rules. If you specify UDP as the protocol but omit this object, then all destination ports are allowed.
Show Source
Nested Schema : PortRange
Type:
Show Source
object
-
max(required):
integer
Minimum Value:
1
Maximum Value:65535
The maximum port number, which must not be less than the minimum port number. To specify a single port number, set both the min and max to the same value. -
min(required):
integer
Minimum Value:
1
Maximum Value:65535
The minimum port number, which must not be greater than the maximum port number.
Response
Supported Media Types
- application/json
200 Response
The security rules were added.
Headers
-
opc-request-id: string
Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.
Root Schema : AddedNetworkSecurityGroupSecurityRules
Type:
Show Source
object
-
securityRules:
array securityRules
The NSG security rules that were added.
Nested Schema : securityRules
Type:
array
The NSG security rules that were added.
Show Source
-
Array of:
object SecurityRule
A security rule is a virtual firewall rule for the VNICs in a NetworkSecurityGroup. A rule can be for either inbound (direction= INGRESS) or outbound (direction= EGRESS) IP packets.
Nested Schema : SecurityRule
Type:
object
A security rule is a virtual firewall rule for the VNICs in a NetworkSecurityGroup. A rule can be for either inbound (direction= INGRESS) or outbound (direction= EGRESS) IP packets.
Show Source
-
description:
string
Minimum Length:
1
Maximum Length:255
An optional description of your choice for the rule. -
destination:
string
This is the range of IP addresses that a packet originating from the instance can go to. The following values are allowed:
- An IP address range in CIDR notation. For example: 192.168.1.0/24 or 2001:0db8:0123:45::/56
- 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.
- 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.
-
destinationType:
string
Allowed Values:
[ "CIDR_BLOCK", "SERVICE_CIDR_BLOCK", "NETWORK_SECURITY_GROUP" ]
Type of destination for the rule. This value is required if direction = EGRESS. The following values are allowed:- 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.
-
direction(required):
string
Allowed Values:
[ "EGRESS", "INGRESS" ]
Direction of the security rule. Set to EGRESS for rules to allow outbound IP packets. Set to INGRESS for rules to allow inbound IP packets. -
icmpOptions:
object IcmpOptions
Optional and valid only for ICMP and ICMPv6. Use to specify a particular ICMP type and code as defined in: - [ICMP Parameters](http://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml) - [ICMPv6 Parameters](https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml) If you specify ICMP or ICMPv6 as the protocol but omit this object, then all ICMP types and codes are allowed. If you do provide this object, the type is required and the code is optional. To enable MTU negotiation for ingress internet traffic via IPv4, make sure to allow type 3 ("Destination Unreachable") code 4 ("Fragmentation Needed and Don't Fragment was Set"). If you need to specify multiple codes for a single type, create a separate security list rule for each.
-
id:
string
Minimum Length:
1
Maximum Length:255
The OCID for the security rule. Specify this OCID when you want to update or delete the rule. -
isStateless:
boolean
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. The default value is false, which means the rule is stateful and a corresponding rule is not necessary for bidirectional traffic.
-
isValid:
boolean
Whether the rule is valid. This 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.
-
protocol(required):
string
The transport protocol. Specify either all or an IPv4 protocol number as defined in [Protocol Numbers](http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml). Only the following are supported: 1 - ICMP, 6 - TCP, 17 - UDP, and 58 - ICMPv6.
-
source:
string
This is the range of IP addresses that a packet coming into the instance can come from. The following values are allowed:
- An IP address range in CIDR notation. For example: 192.168.1.0/24 or 2001:0db8:0123:45::/56
- 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.
- 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.
-
sourceType:
string
Allowed Values:
[ "CIDR_BLOCK", "SERVICE_CIDR_BLOCK", "NETWORK_SECURITY_GROUP" ]
Type of source for the rule. This value is 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.
-
tcpOptions:
object TcpOptions
Optional and valid only for TCP. Use to specify particular destination ports for TCP rules. If you specify TCP as the protocol but omit this object, then all destination ports are allowed.
-
timeCreated:
string(date-time)
The date and time the security rule was created. Format defined by [RFC 3339](https://tools.ietf.org/html/rfc3339).
-
udpOptions:
object UdpOptions
Optional and valid only for UDP. Use to specify particular destination ports for UDP rules. If you specify UDP as the protocol but omit this object, then all destination ports are allowed.
Nested Schema : IcmpOptions
Type:
object
Optional and valid only for ICMP and ICMPv6. Use to specify a particular ICMP type and code as defined in: - [ICMP Parameters](http://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml) - [ICMPv6 Parameters](https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml) If you specify ICMP or ICMPv6 as the protocol but omit this object, then all ICMP types and codes are allowed. If you do provide this object, the type is required and the code is optional. To enable MTU negotiation for ingress internet traffic via IPv4, make sure to allow type 3 ("Destination Unreachable") code 4 ("Fragmentation Needed and Don't Fragment was Set"). If you need to specify multiple codes for a single type, create a separate security list rule for each.
Show Source
-
code:
integer
Minimum Value:
0
Maximum Value:16
The ICMP code (optional). -
type(required):
integer
Minimum Value:
0
Maximum Value:254
The ICMP type.
Nested Schema : TcpOptions
Type:
object
Optional and valid only for TCP. Use to specify particular destination ports for TCP rules. If you specify TCP as the protocol but omit this object, then all destination ports are allowed.
Show Source
Nested Schema : UdpOptions
Type:
object
Optional and valid only for UDP. Use to specify particular destination ports for UDP rules. If you specify UDP as the protocol but omit this object, then all destination ports are allowed.
Show Source
Nested Schema : PortRange
Type:
Show Source
object
-
max(required):
integer
Minimum Value:
1
Maximum Value:65535
The maximum port number, which must not be less than the minimum port number. To specify a single port number, set both the min and max to the same value. -
min(required):
integer
Minimum Value:
1
Maximum Value:65535
The minimum port number, which must not be greater than the maximum port number.
400 Response
Bad Request
Headers
-
opc-request-id: string
Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.
Root Schema : Error
Type:
object
The properties that define an error.
Show Source
-
code(required):
string
A short error code that defines the error, meant for programmatic parsing. See [API Errors](https://docs.us-phoenix-1.oraclecloud.com/Content/API/References/apierrors.htm).
-
message(required):
string
A human-readable error string.
401 Response
Unauthorized
Headers
-
opc-request-id: string
Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.
Root Schema : Error
Type:
object
The properties that define an error.
Show Source
-
code(required):
string
A short error code that defines the error, meant for programmatic parsing. See [API Errors](https://docs.us-phoenix-1.oraclecloud.com/Content/API/References/apierrors.htm).
-
message(required):
string
A human-readable error string.
404 Response
Not Found
Headers
-
opc-request-id: string
Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.
Root Schema : Error
Type:
object
The properties that define an error.
Show Source
-
code(required):
string
A short error code that defines the error, meant for programmatic parsing. See [API Errors](https://docs.us-phoenix-1.oraclecloud.com/Content/API/References/apierrors.htm).
-
message(required):
string
A human-readable error string.
409 Response
Conflict
Headers
-
opc-request-id: string
Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.
Root Schema : Error
Type:
object
The properties that define an error.
Show Source
-
code(required):
string
A short error code that defines the error, meant for programmatic parsing. See [API Errors](https://docs.us-phoenix-1.oraclecloud.com/Content/API/References/apierrors.htm).
-
message(required):
string
A human-readable error string.
500 Response
Internal Server Error
Headers
-
opc-request-id: string
Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.
Root Schema : Error
Type:
object
The properties that define an error.
Show Source
-
code(required):
string
A short error code that defines the error, meant for programmatic parsing. See [API Errors](https://docs.us-phoenix-1.oraclecloud.com/Content/API/References/apierrors.htm).
-
message(required):
string
A human-readable error string.
Default Response
An error has occurred.
Headers
-
opc-request-id: string
Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.
Root Schema : Error
Type:
object
The properties that define an error.
Show Source
-
code(required):
string
A short error code that defines the error, meant for programmatic parsing. See [API Errors](https://docs.us-phoenix-1.oraclecloud.com/Content/API/References/apierrors.htm).
-
message(required):
string
A human-readable error string.