Skip to main content

Firewall

Struct Firewall 

Source
#[non_exhaustive]
pub struct Firewall {
Show 20 fields pub allowed: Vec<Allowed>, pub creation_timestamp: Option<String>, pub denied: Vec<Denied>, pub description: Option<String>, pub destination_ranges: Vec<String>, pub direction: Option<Direction>, pub disabled: Option<bool>, pub id: Option<u64>, pub kind: Option<String>, pub log_config: Option<FirewallLogConfig>, pub name: Option<String>, pub network: Option<String>, pub params: Option<FirewallParams>, pub priority: Option<i32>, pub self_link: Option<String>, pub source_ranges: Vec<String>, pub source_service_accounts: Vec<String>, pub source_tags: Vec<String>, pub target_service_accounts: Vec<String>, pub target_tags: Vec<String>, /* private fields */
}
Available on crate features firewalls or instances or networks or region-network-firewall-policies only.
Expand description

Represents a Firewall Rule resource.

Firewall rules allow or deny ingress traffic to, and egress traffic from your instances. For more information, readFirewall rules.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§allowed: Vec<Allowed>

The list of ALLOW rules specified by this firewall. Each rule specifies a protocol and port-range tuple that describes a permitted connection.

§creation_timestamp: Option<String>

Output only. [Output Only] Creation timestamp inRFC3339 text format.

§denied: Vec<Denied>

The list of DENY rules specified by this firewall. Each rule specifies a protocol and port-range tuple that describes a denied connection.

§description: Option<String>

An optional description of this resource. Provide this field when you create the resource.

§destination_ranges: Vec<String>

If destination ranges are specified, the firewall rule applies only to traffic that has destination IP address in these ranges. These ranges must be expressed inCIDR format. Both IPv4 and IPv6 are supported.

§direction: Option<Direction>

Direction of traffic to which this firewall applies, either INGRESS or EGRESS. The default is INGRESS. For EGRESS traffic, you cannot specify the sourceTags fields.

§disabled: Option<bool>

Denotes whether the firewall rule is disabled. When set to true, the firewall rule is not enforced and the network behaves as if it did not exist. If this is unspecified, the firewall rule will be enabled.

§id: Option<u64>

Output only. [Output Only] The unique identifier for the resource. This identifier is defined by the server.

§kind: Option<String>

Output only. [Output Only] Type of the resource. Always compute#firewall for firewall rules.

§log_config: Option<FirewallLogConfig>

This field denotes the logging options for a particular firewall rule. If logging is enabled, logs will be exported to Cloud Logging.

§name: Option<String>

Name of the resource; provided by the client when the resource is created. The name must be 1-63 characters long, and comply withRFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])?. The first character must be a lowercase letter, and all following characters (except for the last character) must be a dash, lowercase letter, or digit. The last character must be a lowercase letter or digit.

§network: Option<String>

URL of the network resource for this firewall rule. If not specified when creating a firewall rule, the default network is used:

global/networks/default

If you choose to specify this field, you can specify the network as a full or partial URL. For example, the following are all valid URLs:

https://www.googleapis.com/compute/v1/projects/myproject/global/networks/my-network

  • projects/myproject/global/networks/my-network
  • global/networks/default
§params: Option<FirewallParams>

Input only. [Input Only] Additional params passed with the request, but not persisted as part of resource payload.

§priority: Option<i32>

Priority for this rule. This is an integer between 0 and 65535, both inclusive. The default value is 1000. Relative priorities determine which rule takes effect if multiple rules apply. Lower values indicate higher priority. For example, a rule with priority 0 has higher precedence than a rule with priority 1. DENY rules take precedence over ALLOW rules if they have equal priority. Note that VPC networks have implied rules with a priority of 65535. To avoid conflicts with the implied rules, use a priority number less than 65535.

§self_link: Option<String>

[Output Only] Server-defined URL for the resource.

§source_ranges: Vec<String>

If source ranges are specified, the firewall rule applies only to traffic that has a source IP address in these ranges. These ranges must be expressed inCIDR format. One or both of sourceRanges and sourceTags may be set. If both fields are set, the rule applies to traffic that has a source IP address within sourceRanges OR a source IP from a resource with a matching tag listed in thesourceTags field. The connection does not need to match both fields for the rule to apply. Both IPv4 and IPv6 are supported.

§source_service_accounts: Vec<String>

If source service accounts are specified, the firewall rules apply only to traffic originating from an instance with a service account in this list. Source service accounts cannot be used to control traffic to an instance’s external IP address because service accounts are associated with an instance, not an IP address.sourceRanges can be set at the same time assourceServiceAccounts. If both are set, the firewall applies to traffic that has a source IP address within the sourceRanges OR a source IP that belongs to an instance with service account listed insourceServiceAccount. The connection does not need to match both fields for the firewall to apply.sourceServiceAccounts cannot be used at the same time assourceTags or targetTags.

§source_tags: Vec<String>

If source tags are specified, the firewall rule applies only to traffic with source IPs that match the primary network interfaces of VM instances that have the tag and are in the same VPC network. Source tags cannot be used to control traffic to an instance’s external IP address, it only applies to traffic between instances in the same virtual network. Because tags are associated with instances, not IP addresses. One or both of sourceRanges and sourceTags may be set. If both fields are set, the firewall applies to traffic that has a source IP address within sourceRanges OR a source IP from a resource with a matching tag listed in the sourceTags field. The connection does not need to match both fields for the firewall to apply.

§target_service_accounts: Vec<String>

A list of service accounts indicating sets of instances located in the network that may make network connections as specified inallowed[].targetServiceAccounts cannot be used at the same time astargetTags or sourceTags. If neither targetServiceAccounts nor targetTags are specified, the firewall rule applies to all instances on the specified network.

§target_tags: Vec<String>

A list of tags that controls which instances the firewall rule applies to. If targetTags are specified, then the firewall rule applies only to instances in the VPC network that have one of those tags. If no targetTags are specified, the firewall rule applies to all instances on the specified network.

Implementations§

Source§

impl Firewall

Source

pub fn new() -> Self

Source

pub fn set_allowed<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<Allowed>,

Sets the value of allowed.

§Example
use google_cloud_compute_v1::model::firewall::Allowed;
let x = Firewall::new()
    .set_allowed([
        Allowed::default()/* use setters */,
        Allowed::default()/* use (different) setters */,
    ]);
Source

pub fn set_creation_timestamp<T>(self, v: T) -> Self
where T: Into<String>,

Sets the value of creation_timestamp.

§Example
let x = Firewall::new().set_creation_timestamp("example");
Source

pub fn set_or_clear_creation_timestamp<T>(self, v: Option<T>) -> Self
where T: Into<String>,

Sets or clears the value of creation_timestamp.

§Example
let x = Firewall::new().set_or_clear_creation_timestamp(Some("example"));
let x = Firewall::new().set_or_clear_creation_timestamp(None::<String>);
Source

pub fn set_denied<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<Denied>,

Sets the value of denied.

§Example
use google_cloud_compute_v1::model::firewall::Denied;
let x = Firewall::new()
    .set_denied([
        Denied::default()/* use setters */,
        Denied::default()/* use (different) setters */,
    ]);
Source

pub fn set_description<T>(self, v: T) -> Self
where T: Into<String>,

Sets the value of description.

§Example
let x = Firewall::new().set_description("example");
Source

pub fn set_or_clear_description<T>(self, v: Option<T>) -> Self
where T: Into<String>,

Sets or clears the value of description.

§Example
let x = Firewall::new().set_or_clear_description(Some("example"));
let x = Firewall::new().set_or_clear_description(None::<String>);
Source

pub fn set_destination_ranges<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<String>,

Sets the value of destination_ranges.

§Example
let x = Firewall::new().set_destination_ranges(["a", "b", "c"]);
Source

pub fn set_direction<T>(self, v: T) -> Self
where T: Into<Direction>,

Sets the value of direction.

§Example
use google_cloud_compute_v1::model::firewall::Direction;
let x0 = Firewall::new().set_direction(Direction::Ingress);
Source

pub fn set_or_clear_direction<T>(self, v: Option<T>) -> Self
where T: Into<Direction>,

Sets or clears the value of direction.

§Example
use google_cloud_compute_v1::model::firewall::Direction;
let x0 = Firewall::new().set_or_clear_direction(Some(Direction::Ingress));
let x_none = Firewall::new().set_or_clear_direction(None::<Direction>);
Source

pub fn set_disabled<T>(self, v: T) -> Self
where T: Into<bool>,

Sets the value of disabled.

§Example
let x = Firewall::new().set_disabled(true);
Source

pub fn set_or_clear_disabled<T>(self, v: Option<T>) -> Self
where T: Into<bool>,

Sets or clears the value of disabled.

§Example
let x = Firewall::new().set_or_clear_disabled(Some(false));
let x = Firewall::new().set_or_clear_disabled(None::<bool>);
Source

pub fn set_id<T>(self, v: T) -> Self
where T: Into<u64>,

Sets the value of id.

§Example
let x = Firewall::new().set_id(42_u32);
Source

pub fn set_or_clear_id<T>(self, v: Option<T>) -> Self
where T: Into<u64>,

Sets or clears the value of id.

§Example
let x = Firewall::new().set_or_clear_id(Some(42_u32));
let x = Firewall::new().set_or_clear_id(None::<u32>);
Source

pub fn set_kind<T>(self, v: T) -> Self
where T: Into<String>,

Sets the value of kind.

§Example
let x = Firewall::new().set_kind("example");
Source

pub fn set_or_clear_kind<T>(self, v: Option<T>) -> Self
where T: Into<String>,

Sets or clears the value of kind.

§Example
let x = Firewall::new().set_or_clear_kind(Some("example"));
let x = Firewall::new().set_or_clear_kind(None::<String>);
Source

pub fn set_log_config<T>(self, v: T) -> Self

Sets the value of log_config.

§Example
use google_cloud_compute_v1::model::FirewallLogConfig;
let x = Firewall::new().set_log_config(FirewallLogConfig::default()/* use setters */);
Source

pub fn set_or_clear_log_config<T>(self, v: Option<T>) -> Self

Sets or clears the value of log_config.

§Example
use google_cloud_compute_v1::model::FirewallLogConfig;
let x = Firewall::new().set_or_clear_log_config(Some(FirewallLogConfig::default()/* use setters */));
let x = Firewall::new().set_or_clear_log_config(None::<FirewallLogConfig>);
Source

pub fn set_name<T>(self, v: T) -> Self
where T: Into<String>,

Sets the value of name.

§Example
let x = Firewall::new().set_name("example");
Source

pub fn set_or_clear_name<T>(self, v: Option<T>) -> Self
where T: Into<String>,

Sets or clears the value of name.

§Example
let x = Firewall::new().set_or_clear_name(Some("example"));
let x = Firewall::new().set_or_clear_name(None::<String>);
Source

pub fn set_network<T>(self, v: T) -> Self
where T: Into<String>,

Sets the value of network.

§Example
let x = Firewall::new().set_network("example");
Source

pub fn set_or_clear_network<T>(self, v: Option<T>) -> Self
where T: Into<String>,

Sets or clears the value of network.

§Example
let x = Firewall::new().set_or_clear_network(Some("example"));
let x = Firewall::new().set_or_clear_network(None::<String>);
Source

pub fn set_params<T>(self, v: T) -> Self
where T: Into<FirewallParams>,

Sets the value of params.

§Example
use google_cloud_compute_v1::model::FirewallParams;
let x = Firewall::new().set_params(FirewallParams::default()/* use setters */);
Source

pub fn set_or_clear_params<T>(self, v: Option<T>) -> Self
where T: Into<FirewallParams>,

Sets or clears the value of params.

§Example
use google_cloud_compute_v1::model::FirewallParams;
let x = Firewall::new().set_or_clear_params(Some(FirewallParams::default()/* use setters */));
let x = Firewall::new().set_or_clear_params(None::<FirewallParams>);
Source

pub fn set_priority<T>(self, v: T) -> Self
where T: Into<i32>,

Sets the value of priority.

§Example
let x = Firewall::new().set_priority(42);
Source

pub fn set_or_clear_priority<T>(self, v: Option<T>) -> Self
where T: Into<i32>,

Sets or clears the value of priority.

§Example
let x = Firewall::new().set_or_clear_priority(Some(42));
let x = Firewall::new().set_or_clear_priority(None::<i32>);

Sets the value of self_link.

§Example
let x = Firewall::new().set_self_link("example");

Sets or clears the value of self_link.

§Example
let x = Firewall::new().set_or_clear_self_link(Some("example"));
let x = Firewall::new().set_or_clear_self_link(None::<String>);
Source

pub fn set_source_ranges<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<String>,

Sets the value of source_ranges.

§Example
let x = Firewall::new().set_source_ranges(["a", "b", "c"]);
Source

pub fn set_source_service_accounts<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<String>,

Sets the value of source_service_accounts.

§Example
let x = Firewall::new().set_source_service_accounts(["a", "b", "c"]);
Source

pub fn set_source_tags<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<String>,

Sets the value of source_tags.

§Example
let x = Firewall::new().set_source_tags(["a", "b", "c"]);
Source

pub fn set_target_service_accounts<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<String>,

Sets the value of target_service_accounts.

§Example
let x = Firewall::new().set_target_service_accounts(["a", "b", "c"]);
Source

pub fn set_target_tags<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<String>,

Sets the value of target_tags.

§Example
let x = Firewall::new().set_target_tags(["a", "b", "c"]);

Trait Implementations§

Source§

impl Clone for Firewall

Source§

fn clone(&self) -> Firewall

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 Firewall

Source§

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

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

impl Default for Firewall

Source§

fn default() -> Firewall

Returns the “default value” for a type. Read more
Source§

impl Message for Firewall

Source§

fn typename() -> &'static str

The typename of this message.
Source§

impl PartialEq for Firewall

Source§

fn eq(&self, other: &Firewall) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Firewall

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<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> 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>,