pub struct ConsumerRestrictionBuilder {
pub type_field: Option<ConsumerRestrictionType>,
pub whitelist: Option<Vec<String>>,
pub blacklist: Option<Vec<String>>,
pub rejected_code: Option<i32>,
pub rejected_msg: Option<String>,
pub allowed_by_methods: Option<Vec<AllowedByMethods>>,
}Expand description
Builder pattern to create a ConsumerRestriction
Fields§
§type_field: Option<ConsumerRestrictionType>§whitelist: Option<Vec<String>>§blacklist: Option<Vec<String>>§rejected_code: Option<i32>§rejected_msg: Option<String>§allowed_by_methods: Option<Vec<AllowedByMethods>>Implementations§
Source§impl ConsumerRestrictionBuilder
impl ConsumerRestrictionBuilder
pub fn new() -> Self
Sourcepub fn with_type(self, type_field: ConsumerRestrictionType) -> Self
pub fn with_type(self, type_field: ConsumerRestrictionType) -> Self
Type of object to base the restriction on.
Sourcepub fn with_whitelist(self, whitelist: Vec<String>) -> Self
pub fn with_whitelist(self, whitelist: Vec<String>) -> Self
List of objects to whitelist. Has a higher priority than allowed_by_methods.
Sourcepub fn with_blacklist(self, blacklist: Vec<String>) -> Self
pub fn with_blacklist(self, blacklist: Vec<String>) -> Self
List of objects to blacklist. Has a higher priority than whitelist.
Sourcepub fn with_rejected_code(self, rejected_code: i32) -> Self
pub fn with_rejected_code(self, rejected_code: i32) -> Self
HTTP status code returned when the request is rejected.
Sourcepub fn with_rejected_msg(self, rejected_msg: impl Into<String>) -> Self
pub fn with_rejected_msg(self, rejected_msg: impl Into<String>) -> Self
Message returned when the request is rejected.
Sourcepub fn with_allowed_by_methods(
self,
allowed_by_methods: Vec<AllowedByMethods>,
) -> Self
pub fn with_allowed_by_methods( self, allowed_by_methods: Vec<AllowedByMethods>, ) -> Self
List of allowed configurations for Consumer settings, including a username of the Consumer and a list of allowed HTTP methods.
pub fn build(self) -> Result<ConsumerRestriction, ApisixClientError>
Trait Implementations§
Source§impl Clone for ConsumerRestrictionBuilder
impl Clone for ConsumerRestrictionBuilder
Source§fn clone(&self) -> ConsumerRestrictionBuilder
fn clone(&self) -> ConsumerRestrictionBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ConsumerRestrictionBuilder
impl Debug for ConsumerRestrictionBuilder
Source§impl Default for ConsumerRestrictionBuilder
impl Default for ConsumerRestrictionBuilder
Source§fn default() -> ConsumerRestrictionBuilder
fn default() -> ConsumerRestrictionBuilder
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ConsumerRestrictionBuilder
impl<'de> Deserialize<'de> for ConsumerRestrictionBuilder
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 From<ConsumerRestriction> for ConsumerRestrictionBuilder
impl From<ConsumerRestriction> for ConsumerRestrictionBuilder
Source§fn from(consumer_restriction: ConsumerRestriction) -> Self
fn from(consumer_restriction: ConsumerRestriction) -> Self
Converts to this type from the input type.
Source§impl<'v_a> ValidateArgs<'v_a> for ConsumerRestrictionBuilder
impl<'v_a> ValidateArgs<'v_a> for ConsumerRestrictionBuilder
impl StructuralPartialEq for ConsumerRestrictionBuilder
Auto Trait Implementations§
impl Freeze for ConsumerRestrictionBuilder
impl RefUnwindSafe for ConsumerRestrictionBuilder
impl Send for ConsumerRestrictionBuilder
impl Sync for ConsumerRestrictionBuilder
impl Unpin for ConsumerRestrictionBuilder
impl UnwindSafe for ConsumerRestrictionBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more