DataQualityRule

Struct DataQualityRule 

Source
#[non_exhaustive]
pub struct DataQualityRule { pub column: String, pub ignore_null: bool, pub dimension: String, pub threshold: f64, pub name: String, pub description: String, pub suspended: bool, pub rule_type: Option<RuleType>, /* private fields */ }
Expand description

A rule captures data quality intent about a data source.

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

Optional. The unnested column which this rule is evaluated against.

§ignore_null: bool

Optional. Rows with null values will automatically fail a rule, unless ignore_null is true. In that case, such null rows are trivially considered passing.

This field is only valid for the following type of rules:

  • RangeExpectation
  • RegexExpectation
  • SetExpectation
  • UniquenessExpectation
§dimension: String

Required. The dimension a rule belongs to. Results are also aggregated at the dimension level. Custom dimension name is supported with all uppercase letters and maximum length of 30 characters.

§threshold: f64

Optional. The minimum ratio of passing_rows / total_rows required to pass this rule, with a range of [0.0, 1.0].

0 indicates default value (i.e. 1.0).

This field is only valid for row-level type rules.

§name: String

Optional. A mutable name for the rule.

  • The name must contain only letters (a-z, A-Z), numbers (0-9), or hyphens (-).
  • The maximum length is 63 characters.
  • Must start with a letter.
  • Must end with a number or a letter.
§description: String

Optional. Description of the rule.

  • The maximum length is 1,024 characters.
§suspended: bool

Optional. Whether the Rule is active or suspended. Default is false.

§rule_type: Option<RuleType>

The rule-specific configuration.

Implementations§

Source§

impl DataQualityRule

Source

pub fn new() -> Self

Source

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

Sets the value of column.

§Example
let x = DataQualityRule::new().set_column("example");
Source

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

Sets the value of ignore_null.

§Example
let x = DataQualityRule::new().set_ignore_null(true);
Source

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

Sets the value of dimension.

§Example
let x = DataQualityRule::new().set_dimension("example");
Source

pub fn set_threshold<T: Into<f64>>(self, v: T) -> Self

Sets the value of threshold.

§Example
let x = DataQualityRule::new().set_threshold(42.0);
Source

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

Sets the value of name.

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

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

Sets the value of description.

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

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

Sets the value of suspended.

§Example
let x = DataQualityRule::new().set_suspended(true);
Source

pub fn set_rule_type<T: Into<Option<RuleType>>>(self, v: T) -> Self

Sets the value of rule_type.

Note that all the setters affecting rule_type are mutually exclusive.

§Example
use google_cloud_dataplex_v1::model::data_quality_rule::RangeExpectation;
let x = DataQualityRule::new().set_rule_type(Some(
    google_cloud_dataplex_v1::model::data_quality_rule::RuleType::RangeExpectation(RangeExpectation::default().into())));
Source

pub fn range_expectation(&self) -> Option<&Box<RangeExpectation>>

The value of rule_type if it holds a RangeExpectation, None if the field is not set or holds a different branch.

Source

pub fn set_range_expectation<T: Into<Box<RangeExpectation>>>(self, v: T) -> Self

Sets the value of rule_type to hold a RangeExpectation.

Note that all the setters affecting rule_type are mutually exclusive.

§Example
use google_cloud_dataplex_v1::model::data_quality_rule::RangeExpectation;
let x = DataQualityRule::new().set_range_expectation(RangeExpectation::default()/* use setters */);
assert!(x.range_expectation().is_some());
assert!(x.non_null_expectation().is_none());
assert!(x.set_expectation().is_none());
assert!(x.regex_expectation().is_none());
assert!(x.uniqueness_expectation().is_none());
assert!(x.statistic_range_expectation().is_none());
assert!(x.row_condition_expectation().is_none());
assert!(x.table_condition_expectation().is_none());
assert!(x.sql_assertion().is_none());
Source

pub fn non_null_expectation(&self) -> Option<&Box<NonNullExpectation>>

The value of rule_type if it holds a NonNullExpectation, None if the field is not set or holds a different branch.

Source

pub fn set_non_null_expectation<T: Into<Box<NonNullExpectation>>>( self, v: T, ) -> Self

Sets the value of rule_type to hold a NonNullExpectation.

Note that all the setters affecting rule_type are mutually exclusive.

§Example
use google_cloud_dataplex_v1::model::data_quality_rule::NonNullExpectation;
let x = DataQualityRule::new().set_non_null_expectation(NonNullExpectation::default()/* use setters */);
assert!(x.non_null_expectation().is_some());
assert!(x.range_expectation().is_none());
assert!(x.set_expectation().is_none());
assert!(x.regex_expectation().is_none());
assert!(x.uniqueness_expectation().is_none());
assert!(x.statistic_range_expectation().is_none());
assert!(x.row_condition_expectation().is_none());
assert!(x.table_condition_expectation().is_none());
assert!(x.sql_assertion().is_none());
Source

pub fn set_expectation(&self) -> Option<&Box<SetExpectation>>

The value of rule_type if it holds a SetExpectation, None if the field is not set or holds a different branch.

Source

pub fn set_set_expectation<T: Into<Box<SetExpectation>>>(self, v: T) -> Self

Sets the value of rule_type to hold a SetExpectation.

Note that all the setters affecting rule_type are mutually exclusive.

§Example
use google_cloud_dataplex_v1::model::data_quality_rule::SetExpectation;
let x = DataQualityRule::new().set_set_expectation(SetExpectation::default()/* use setters */);
assert!(x.set_expectation().is_some());
assert!(x.range_expectation().is_none());
assert!(x.non_null_expectation().is_none());
assert!(x.regex_expectation().is_none());
assert!(x.uniqueness_expectation().is_none());
assert!(x.statistic_range_expectation().is_none());
assert!(x.row_condition_expectation().is_none());
assert!(x.table_condition_expectation().is_none());
assert!(x.sql_assertion().is_none());
Source

pub fn regex_expectation(&self) -> Option<&Box<RegexExpectation>>

The value of rule_type if it holds a RegexExpectation, None if the field is not set or holds a different branch.

Source

pub fn set_regex_expectation<T: Into<Box<RegexExpectation>>>(self, v: T) -> Self

Sets the value of rule_type to hold a RegexExpectation.

Note that all the setters affecting rule_type are mutually exclusive.

§Example
use google_cloud_dataplex_v1::model::data_quality_rule::RegexExpectation;
let x = DataQualityRule::new().set_regex_expectation(RegexExpectation::default()/* use setters */);
assert!(x.regex_expectation().is_some());
assert!(x.range_expectation().is_none());
assert!(x.non_null_expectation().is_none());
assert!(x.set_expectation().is_none());
assert!(x.uniqueness_expectation().is_none());
assert!(x.statistic_range_expectation().is_none());
assert!(x.row_condition_expectation().is_none());
assert!(x.table_condition_expectation().is_none());
assert!(x.sql_assertion().is_none());
Source

pub fn uniqueness_expectation(&self) -> Option<&Box<UniquenessExpectation>>

The value of rule_type if it holds a UniquenessExpectation, None if the field is not set or holds a different branch.

Source

pub fn set_uniqueness_expectation<T: Into<Box<UniquenessExpectation>>>( self, v: T, ) -> Self

Sets the value of rule_type to hold a UniquenessExpectation.

Note that all the setters affecting rule_type are mutually exclusive.

§Example
use google_cloud_dataplex_v1::model::data_quality_rule::UniquenessExpectation;
let x = DataQualityRule::new().set_uniqueness_expectation(UniquenessExpectation::default()/* use setters */);
assert!(x.uniqueness_expectation().is_some());
assert!(x.range_expectation().is_none());
assert!(x.non_null_expectation().is_none());
assert!(x.set_expectation().is_none());
assert!(x.regex_expectation().is_none());
assert!(x.statistic_range_expectation().is_none());
assert!(x.row_condition_expectation().is_none());
assert!(x.table_condition_expectation().is_none());
assert!(x.sql_assertion().is_none());
Source

pub fn statistic_range_expectation( &self, ) -> Option<&Box<StatisticRangeExpectation>>

The value of rule_type if it holds a StatisticRangeExpectation, None if the field is not set or holds a different branch.

Source

pub fn set_statistic_range_expectation<T: Into<Box<StatisticRangeExpectation>>>( self, v: T, ) -> Self

Sets the value of rule_type to hold a StatisticRangeExpectation.

Note that all the setters affecting rule_type are mutually exclusive.

§Example
use google_cloud_dataplex_v1::model::data_quality_rule::StatisticRangeExpectation;
let x = DataQualityRule::new().set_statistic_range_expectation(StatisticRangeExpectation::default()/* use setters */);
assert!(x.statistic_range_expectation().is_some());
assert!(x.range_expectation().is_none());
assert!(x.non_null_expectation().is_none());
assert!(x.set_expectation().is_none());
assert!(x.regex_expectation().is_none());
assert!(x.uniqueness_expectation().is_none());
assert!(x.row_condition_expectation().is_none());
assert!(x.table_condition_expectation().is_none());
assert!(x.sql_assertion().is_none());
Source

pub fn row_condition_expectation(&self) -> Option<&Box<RowConditionExpectation>>

The value of rule_type if it holds a RowConditionExpectation, None if the field is not set or holds a different branch.

Source

pub fn set_row_condition_expectation<T: Into<Box<RowConditionExpectation>>>( self, v: T, ) -> Self

Sets the value of rule_type to hold a RowConditionExpectation.

Note that all the setters affecting rule_type are mutually exclusive.

§Example
use google_cloud_dataplex_v1::model::data_quality_rule::RowConditionExpectation;
let x = DataQualityRule::new().set_row_condition_expectation(RowConditionExpectation::default()/* use setters */);
assert!(x.row_condition_expectation().is_some());
assert!(x.range_expectation().is_none());
assert!(x.non_null_expectation().is_none());
assert!(x.set_expectation().is_none());
assert!(x.regex_expectation().is_none());
assert!(x.uniqueness_expectation().is_none());
assert!(x.statistic_range_expectation().is_none());
assert!(x.table_condition_expectation().is_none());
assert!(x.sql_assertion().is_none());
Source

pub fn table_condition_expectation( &self, ) -> Option<&Box<TableConditionExpectation>>

The value of rule_type if it holds a TableConditionExpectation, None if the field is not set or holds a different branch.

Source

pub fn set_table_condition_expectation<T: Into<Box<TableConditionExpectation>>>( self, v: T, ) -> Self

Sets the value of rule_type to hold a TableConditionExpectation.

Note that all the setters affecting rule_type are mutually exclusive.

§Example
use google_cloud_dataplex_v1::model::data_quality_rule::TableConditionExpectation;
let x = DataQualityRule::new().set_table_condition_expectation(TableConditionExpectation::default()/* use setters */);
assert!(x.table_condition_expectation().is_some());
assert!(x.range_expectation().is_none());
assert!(x.non_null_expectation().is_none());
assert!(x.set_expectation().is_none());
assert!(x.regex_expectation().is_none());
assert!(x.uniqueness_expectation().is_none());
assert!(x.statistic_range_expectation().is_none());
assert!(x.row_condition_expectation().is_none());
assert!(x.sql_assertion().is_none());
Source

pub fn sql_assertion(&self) -> Option<&Box<SqlAssertion>>

The value of rule_type if it holds a SqlAssertion, None if the field is not set or holds a different branch.

Source

pub fn set_sql_assertion<T: Into<Box<SqlAssertion>>>(self, v: T) -> Self

Sets the value of rule_type to hold a SqlAssertion.

Note that all the setters affecting rule_type are mutually exclusive.

§Example
use google_cloud_dataplex_v1::model::data_quality_rule::SqlAssertion;
let x = DataQualityRule::new().set_sql_assertion(SqlAssertion::default()/* use setters */);
assert!(x.sql_assertion().is_some());
assert!(x.range_expectation().is_none());
assert!(x.non_null_expectation().is_none());
assert!(x.set_expectation().is_none());
assert!(x.regex_expectation().is_none());
assert!(x.uniqueness_expectation().is_none());
assert!(x.statistic_range_expectation().is_none());
assert!(x.row_condition_expectation().is_none());
assert!(x.table_condition_expectation().is_none());

Trait Implementations§

Source§

impl Clone for DataQualityRule

Source§

fn clone(&self) -> DataQualityRule

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 DataQualityRule

Source§

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

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

impl Default for DataQualityRule

Source§

fn default() -> DataQualityRule

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

impl Message for DataQualityRule

Source§

fn typename() -> &'static str

The typename of this message.
Source§

impl PartialEq for DataQualityRule

Source§

fn eq(&self, other: &DataQualityRule) -> 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 DataQualityRule

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