Struct spacegate_kernel::plugins::context::SgRoutePluginContext
source · pub struct SgRoutePluginContext {
pub request: SgCtxRequest,
pub response: SgCtxResponse,
/* private fields */
}Fields§
§request: SgCtxRequest§response: SgCtxResponseImplementations§
source§impl SgRoutePluginContext
impl SgRoutePluginContext
pub fn new_http( method: Method, uri: Uri, version: Version, headers: HeaderMap<HeaderValue>, body: Body, remote_addr: SocketAddr, gateway_name: String, chose_route_rule: Option<ChoseHttpRouteRuleInst> ) -> Self
pub fn new_ws( method: Method, uri: Uri, version: Version, headers: HeaderMap<HeaderValue>, remote_addr: SocketAddr, gateway_name: String, chose_route_rule: Option<ChoseHttpRouteRuleInst> ) -> Self
sourcepub fn resp(
self,
status_code: StatusCode,
headers: HeaderMap<HeaderValue>,
body: Body
) -> Self
pub fn resp( self, status_code: StatusCode, headers: HeaderMap<HeaderValue>, body: Body ) -> Self
The following two methods can only be used to fill in the context [resp] [resp_from_error]
pub fn resp_from_error(self, error: TardisError) -> Self
pub fn is_resp_error(&self) -> bool
pub fn get_request_id(&self) -> &str
pub fn get_request_kind(&self) -> &SgPluginFilterKind
sourcepub async fn build_response(&mut self) -> TardisResult<Response<Body>>
pub async fn build_response(&mut self) -> TardisResult<Response<Body>>
build response from Context
pub fn get_ext(&self, key: &str) -> Option<String>
pub fn set_ext(&mut self, key: &str, value: &str)
pub fn remove_ext(&mut self, key: &str)
pub fn get_action(&self) -> &SgRouteFilterRequestAction
pub fn set_action(&mut self, action: SgRouteFilterRequestAction)
pub fn set_chose_backend(&mut self, chose_backend: &SgBackendInst)
pub fn get_chose_backend_name(&self) -> Option<String>
pub fn get_available_backend(&self) -> Vec<&AvailableBackendInst>
pub fn get_timeout_ms(&self) -> Option<u64>
pub fn get_rule_matched(&self) -> Option<SgHttpRouteMatchInst>
pub fn get_gateway_name(&self) -> String
pub fn get_cert_info(&self) -> Option<&SGCertInfo>
pub fn set_cert_info(&mut self, cert_info: SGCertInfo)
pub fn cache(&self) -> TardisResult<&'static TardisCacheClient>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for SgRoutePluginContext
impl Send for SgRoutePluginContext
impl Sync for SgRoutePluginContext
impl Unpin for SgRoutePluginContext
impl !UnwindSafe for SgRoutePluginContext
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