pub struct UpstreamBuilder {
pub id: Option<String>,
pub retries: Option<i32>,
pub retry_timeout: Option<i32>,
pub timeout: Option<ApisixTimeout>,
pub nodes: Option<Value>,
pub service_name: Option<String>,
pub discovery_type: Option<String>,
pub type_field: Option<UpstreamType>,
pub name: Option<String>,
pub desc: Option<String>,
pub scheme: Option<UpstreamSchema>,
}
Fields§
§id: Option<String>
§retries: Option<i32>
§retry_timeout: Option<i32>
§timeout: Option<ApisixTimeout>
§nodes: Option<Value>
§service_name: Option<String>
§discovery_type: Option<String>
§type_field: Option<UpstreamType>
§name: Option<String>
§desc: Option<String>
§scheme: Option<UpstreamSchema>
Implementations§
source§impl UpstreamBuilder
impl UpstreamBuilder
pub fn new() -> Self
sourcepub fn u_type(self, u_type: UpstreamType) -> Self
pub fn u_type(self, u_type: UpstreamType) -> Self
Load balancing algorithm to be used, and the default value is roundrobin. See UpstreamType
sourcepub fn nodes(self, nodes: Value) -> Self
pub fn nodes(self, nodes: Value) -> Self
IP addresses (with optional ports) of the Upstream nodes represented as a hash table or an array. In the hash table, the key is the IP address and the value is the weight of the node for the load balancing algorithm. For hash table case, if the key is IPv6 address with port, then the IPv6 address must be quoted with square brackets. In the array, each item is a hash table with keys host, weight, and the optional port and priority (defaults to 0). Nodes with lower priority are used only when all nodes with a higher priority are tried and are unavailable. Empty nodes are treated as placeholders and clients trying to access this Upstream will receive a 502 response.
Restrictions: can not be used with service_name
Example: 192.168.1.100:80
, [::1]:80
sourcepub fn service_name(self, service_name: String) -> Self
pub fn service_name(self, service_name: String) -> Self
Service name used for service discovery
Restrictions: can not be used with nodes
sourcepub fn discovery_type(self, discovery_type: String) -> Self
pub fn discovery_type(self, discovery_type: String) -> Self
The type of service discovery to be used. The default value is eureka.
Required when service_name
is defined
sourcepub fn retries(self, retries: i32) -> Self
pub fn retries(self, retries: i32) -> Self
Sets the number of retries while passing the request to Upstream using the underlying Nginx mechanism. Set according to the number of available backend nodes by default. Setting this to 0 disables retry.
sourcepub fn retry_timeout(self, retry_timeout: i32) -> Self
pub fn retry_timeout(self, retry_timeout: i32) -> Self
Timeout to continue with retries. Setting this to 0 disables the retry timeout.
sourcepub fn timeout(self, timeout: ApisixTimeout) -> Self
pub fn timeout(self, timeout: ApisixTimeout) -> Self
Sets the timeout (in seconds) for connecting to, and sending and receiving messages to and from the Upstream.
Example: {“connect”: 0.5,“send”: 0.5,“read”: 0.5}
sourcepub fn schema(self, scheme: UpstreamSchema) -> Self
pub fn schema(self, scheme: UpstreamSchema) -> Self
The scheme used when communicating with the Upstream. For an L7 proxy, this value can be one of http, https, grpc, grpcs. For an L4 proxy, this value could be one of tcp, udp, tls. Defaults to http.
pub fn build(&self) -> Result<UpstreamRequest, ApisixClientError>
Trait Implementations§
source§impl Clone for UpstreamBuilder
impl Clone for UpstreamBuilder
source§fn clone(&self) -> UpstreamBuilder
fn clone(&self) -> UpstreamBuilder
1.6.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for UpstreamBuilder
impl Debug for UpstreamBuilder
source§impl Default for UpstreamBuilder
impl Default for UpstreamBuilder
source§fn default() -> UpstreamBuilder
fn default() -> UpstreamBuilder
source§impl<'de> Deserialize<'de> for UpstreamBuilder
impl<'de> Deserialize<'de> for UpstreamBuilder
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>,
source§impl From<UpstreamRequest> for UpstreamBuilder
impl From<UpstreamRequest> for UpstreamBuilder
source§fn from(upstream: UpstreamRequest) -> Self
fn from(upstream: UpstreamRequest) -> Self
source§impl PartialEq for UpstreamBuilder
impl PartialEq for UpstreamBuilder
source§impl Serialize for UpstreamBuilder
impl Serialize for UpstreamBuilder
impl StructuralPartialEq for UpstreamBuilder
Auto Trait Implementations§
impl Freeze for UpstreamBuilder
impl RefUnwindSafe for UpstreamBuilder
impl Send for UpstreamBuilder
impl Sync for UpstreamBuilder
impl Unpin for UpstreamBuilder
impl UnwindSafe for UpstreamBuilder
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)