Skip to main content

SecurityRule

Struct SecurityRule 

Source
pub struct SecurityRule {
Show 14 fields pub direction: SecurityRuleDirection, pub protocol: String, pub description: Option<String>, pub destination: Option<String>, pub destination_type: Option<SecurityRuleDestinationType>, pub icmp_options: Option<IcmpOptions>, pub id: Option<String>, pub is_stateless: Option<bool>, pub is_valid: Option<bool>, pub source: Option<String>, pub source_type: Option<SecurityRuleSourceType>, pub tcp_options: Option<TcpOptions>, pub time_created: Option<DateTime<Utc>>, pub udp_options: Option<UdpOptions>,
}
Expand description

A security rule is one of the items in a {@link NetworkSecurityGroup}. It is a virtual firewall rule for the VNICs in the network security group. A rule can be for either inbound ({@code direction}= INGRESS) or outbound ({@code direction}= EGRESS) IP packets.

Fields§

§direction: SecurityRuleDirection

Direction of the security rule. Set to {@code EGRESS} for rules to allow outbound IP packets, or {@code INGRESS} for rules to allow inbound IP packets.

§protocol: String

The transport protocol. Specify either {@code 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").

§description: Option<String>

An optional description of your choice for the rule.

§destination: Option<String>

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: {@code 192.168.1.0/24} or {@code 2001:0db8:0123:45::/56} IPv6 addressing is supported for all commercial and government regions. See IPv6 Addresses.

The {@code cidrBlock} value for a {@link Service}, if you’re setting up a security rule for traffic destined for a particular {@code Service} through a service gateway. For example: {@code oci-phx-objectstorage}.

The OCID of a {@link 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.

§destination_type: Option<SecurityRuleDestinationType>

Type of destination for the rule. Required if {@code direction} = {@code EGRESS}.

Allowed values:

{@code CIDR_BLOCK}: If the rule’s {@code destination} is an IP address range in CIDR notation.

{@code SERVICE_CIDR_BLOCK}: If the rule’s {@code destination} is the {@code cidrBlock} value for a {@link Service} (the rule is for traffic destined for a particular {@code Service} through a service gateway).

{@code NETWORK_SECURITY_GROUP}: If the rule’s {@code destination} is the OCID of a {@link NetworkSecurityGroup}.

§icmp_options: Option<IcmpOptions>§id: Option<String>

An Oracle-assigned identifier for the security rule. You specify this ID when you want to update or delete the rule.

Example: {@code 04ABEC}

§is_stateless: Option<bool>

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.

§is_valid: Option<bool>

Whether the rule is valid. The value is {@code True} when the rule is first created. If the rule’s {@code source} or {@code destination} is a network security group, the value changes to {@code False} if that network security group is deleted.

§source: Option<String>

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: {@code 192.168.1.0/24} or {@code 2001:0db8:0123:45::/56} IPv6 addressing is supported for all commercial and government regions. See IPv6 Addresses.

The {@code cidrBlock} value for a {@link Service}, if you’re setting up a security rule for traffic coming from a particular {@code Service} through a service gateway. For example: {@code oci-phx-objectstorage}.

The OCID of a {@link 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.

§source_type: Option<SecurityRuleSourceType>

Type of source for the rule. Required if {@code direction} = {@code INGRESS}.

{@code CIDR_BLOCK}: If the rule’s {@code source} is an IP address range in CIDR notation.

{@code SERVICE_CIDR_BLOCK}: If the rule’s {@code source} is the {@code cidrBlock} value for a {@link Service} (the rule is for traffic coming from a particular {@code Service} through a service gateway).

{@code NETWORK_SECURITY_GROUP}: If the rule’s {@code source} is the OCID of a {@link NetworkSecurityGroup}.

§tcp_options: Option<TcpOptions>§time_created: Option<DateTime<Utc>>

The date and time the security rule was created. Format defined by RFC3339.

§udp_options: Option<UdpOptions>

Implementations§

Source§

impl SecurityRule

Source

pub fn new(required: SecurityRuleRequired) -> Self

Create a new SecurityRule with required fields

Source

pub fn set_description(self, value: Option<String>) -> Self

Set description

Source

pub fn set_destination(self, value: Option<String>) -> Self

Set destination

Source

pub fn set_destination_type( self, value: Option<SecurityRuleDestinationType>, ) -> Self

Set destination_type

Source

pub fn set_direction(self, value: SecurityRuleDirection) -> Self

Set direction

Source

pub fn set_icmp_options(self, value: Option<IcmpOptions>) -> Self

Set icmp_options

Source

pub fn set_id(self, value: Option<String>) -> Self

Set id

Source

pub fn set_is_stateless(self, value: Option<bool>) -> Self

Set is_stateless

Source

pub fn set_is_valid(self, value: Option<bool>) -> Self

Set is_valid

Source

pub fn set_protocol(self, value: String) -> Self

Set protocol

Source

pub fn set_source(self, value: Option<String>) -> Self

Set source

Source

pub fn set_source_type(self, value: Option<SecurityRuleSourceType>) -> Self

Set source_type

Source

pub fn set_tcp_options(self, value: Option<TcpOptions>) -> Self

Set tcp_options

Source

pub fn set_time_created(self, value: Option<DateTime<Utc>>) -> Self

Set time_created

Source

pub fn set_udp_options(self, value: Option<UdpOptions>) -> Self

Set udp_options

Source

pub fn with_description(self, value: impl Into<String>) -> Self

Set description (unwraps Option)

Source

pub fn with_destination(self, value: impl Into<String>) -> Self

Set destination (unwraps Option)

Source

pub fn with_destination_type(self, value: SecurityRuleDestinationType) -> Self

Set destination_type (unwraps Option)

Source

pub fn with_icmp_options(self, value: IcmpOptions) -> Self

Set icmp_options (unwraps Option)

Source

pub fn with_id(self, value: impl Into<String>) -> Self

Set id (unwraps Option)

Source

pub fn with_is_stateless(self, value: bool) -> Self

Set is_stateless (unwraps Option)

Source

pub fn with_is_valid(self, value: bool) -> Self

Set is_valid (unwraps Option)

Source

pub fn with_source(self, value: impl Into<String>) -> Self

Set source (unwraps Option)

Source

pub fn with_source_type(self, value: SecurityRuleSourceType) -> Self

Set source_type (unwraps Option)

Source

pub fn with_tcp_options(self, value: TcpOptions) -> Self

Set tcp_options (unwraps Option)

Source

pub fn with_time_created(self, value: DateTime<Utc>) -> Self

Set time_created (unwraps Option)

Source

pub fn with_udp_options(self, value: UdpOptions) -> Self

Set udp_options (unwraps Option)

Trait Implementations§

Source§

impl Clone for SecurityRule

Source§

fn clone(&self) -> SecurityRule

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SecurityRule

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for SecurityRule

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for SecurityRule

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,