Skip to main content

Violation

Struct Violation 

Source
#[non_exhaustive]
pub struct Violation { pub subject: String, pub description: String, pub api_service: String, pub quota_metric: String, pub quota_id: String, pub quota_dimensions: HashMap<String, String>, pub quota_value: i64, pub future_quota_value: Option<i64>, /* private fields */ }
Expand description

A message type used to describe a single quota violation. For example, a daily quota or a custom quota that was exceeded.

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.
§subject: String

The subject on which the quota check failed. For example, “clientip:<ip address of client>” or “project:<Google developer project id>”.

§description: String

A description of how the quota check failed. Clients can use this description to find more about the quota configuration in the service’s public documentation, or find the relevant quota limit to adjust through developer console.

For example: “Service disabled” or “Daily Limit for read operations exceeded”.

§api_service: String

The API Service from which the QuotaFailure.Violation orginates. In some cases, Quota issues originate from an API Service other than the one that was called. In other words, a dependency of the called API Service could be the cause of the QuotaFailure, and this field would have the dependency API service name.

For example, if the called API is Kubernetes Engine API (container.googleapis.com), and a quota violation occurs in the Kubernetes Engine API itself, this field would be “container.googleapis.com”. On the other hand, if the quota violation occurs when the Kubernetes Engine API creates VMs in the Compute Engine API (compute.googleapis.com), this field would be “compute.googleapis.com”.

§quota_metric: String

The metric of the violated quota. A quota metric is a named counter to measure usage, such as API requests or CPUs. When an activity occurs in a service, such as Virtual Machine allocation, one or more quota metrics may be affected.

For example, “compute.googleapis.com/cpus_per_vm_family”, “storage.googleapis.com/internet_egress_bandwidth”.

§quota_id: String

The id of the violated quota. Also know as “limit name”, this is the unique identifier of a quota in the context of an API service.

For example, “CPUS-PER-VM-FAMILY-per-project-region”.

§quota_dimensions: HashMap<String, String>

The dimensions of the violated quota. Every non-global quota is enforced on a set of dimensions. While quota metric defines what to count, the dimensions specify for what aspects the counter should be increased.

For example, the quota “CPUs per region per VM family” enforces a limit on the metric “compute.googleapis.com/cpus_per_vm_family” on dimensions “region” and “vm_family”. And if the violation occurred in region “us-central1” and for VM family “n1”, the quota_dimensions would be,

{ “region”: “us-central1”, “vm_family”: “n1”, }

When a quota is enforced globally, the quota_dimensions would always be empty.

§quota_value: i64

The enforced quota value at the time of the QuotaFailure.

For example, if the enforced quota value at the time of the QuotaFailure on the number of CPUs is “10”, then the value of this field would reflect this quantity.

§future_quota_value: Option<i64>

The new quota value being rolled out at the time of the violation. At the completion of the rollout, this value will be enforced in place of quota_value. If no rollout is in progress at the time of the violation, this field is not set.

For example, if at the time of the violation a rollout is in progress changing the number of CPUs quota from 10 to 20, 20 would be the value of this field.

Implementations§

Source§

impl Violation

Source

pub fn new() -> Self

Creates a new default instance.

Source

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

Sets the value of subject.

§Example
ⓘ
let x = Violation::new().set_subject("example");
Source

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

Sets the value of description.

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

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

Sets the value of api_service.

§Example
ⓘ
let x = Violation::new().set_api_service("example");
Source

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

Sets the value of quota_metric.

§Example
ⓘ
let x = Violation::new().set_quota_metric("example");
Source

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

Sets the value of quota_id.

§Example
ⓘ
let x = Violation::new().set_quota_id("example");
Source

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

Sets the value of quota_dimensions.

§Example
ⓘ
let x = Violation::new().set_quota_dimensions([
    ("key0", "abc"),
    ("key1", "xyz"),
]);
Source

pub fn set_quota_value<T: Into<i64>>(self, v: T) -> Self

Sets the value of quota_value.

§Example
ⓘ
let x = Violation::new().set_quota_value(42);
Source

pub fn set_future_quota_value<T>(self, v: T) -> Self
where T: Into<i64>,

Sets the value of future_quota_value.

§Example
ⓘ
let x = Violation::new().set_future_quota_value(42);
Source

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

Sets or clears the value of future_quota_value.

§Example
ⓘ
let x = Violation::new().set_or_clear_future_quota_value(Some(42));
let x = Violation::new().set_or_clear_future_quota_value(None::<i32>);

Trait Implementations§

Source§

impl Clone for Violation

Source§

fn clone(&self) -> Violation

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Violation

Source§

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

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

impl Default for Violation

Source§

fn default() -> Violation

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

impl Message for Violation

Source§

fn typename() -> &'static str

The typename of this message.
Source§

impl PartialEq for Violation

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Violation

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.
§

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

§

fn vzip(self) -> V