pub struct EndpointMetadata {Show 16 fields
pub id: EndpointId,
pub method: Method,
pub path: RoutePath,
pub success_status: StatusCode,
pub authorization: AuthorizationPolicy,
pub rate_limit: Option<RateLimitPolicy>,
pub timeout: Option<Duration>,
pub body_limit: Option<BodyLimitPolicy>,
pub cors: Option<CorsPolicy>,
pub csrf: CsrfPolicy,
pub security_headers: Option<SecurityHeadersPolicy>,
pub response_cache: Option<ResponseCachePolicy>,
pub contracts: EndpointContracts,
pub documentation: OperationDocumentation,
pub telemetry: TelemetryPolicy,
pub tags: Vec<String>,
}Expand description
Portable endpoint definition consumed by framework, auth, docs, and telemetry adapters.
Fields§
§id: EndpointIdStable endpoint identity used by diagnostics and API documentation.
method: MethodHTTP method.
path: RoutePathPortable route path.
success_status: StatusCodeSuccessful response status used when a handler returns plain output.
Authentication and authorization requirement.
rate_limit: Option<RateLimitPolicy>Optional request rate limit.
timeout: Option<Duration>Optional request timeout.
body_limit: Option<BodyLimitPolicy>Optional maximum encoded request body size.
cors: Option<CorsPolicy>Optional cross-origin policy.
csrf: CsrfPolicyCross-site request-forgery requirement.
security_headers: Option<SecurityHeadersPolicy>Optional security response headers. Secure defaults are enabled initially.
response_cache: Option<ResponseCachePolicy>Optional HTTP response caching policy.
contracts: EndpointContractsLogical validation and response schema references.
documentation: OperationDocumentationProvider-neutral operation documentation.
telemetry: TelemetryPolicyProvider-neutral tracing and metrics instructions.
Documentation and grouping tags.
Implementations§
Source§impl EndpointMetadata
impl EndpointMetadata
Sourcepub fn new(
id: impl Into<String>,
method: Method,
path: RoutePath,
) -> SoapResult<Self>
pub fn new( id: impl Into<String>, method: Method, path: RoutePath, ) -> SoapResult<Self>
Creates a public endpoint with secure headers and telemetry enabled.
Sourcepub fn success_status(self, status: StatusCode) -> SoapResult<Self>
pub fn success_status(self, status: StatusCode) -> SoapResult<Self>
Sets a successful 2xx response status.
Sets and validates the authorization policy.
Sourcepub fn rate_limit(self, policy: RateLimitPolicy) -> Self
pub fn rate_limit(self, policy: RateLimitPolicy) -> Self
Sets the rate-limit policy.
Sourcepub fn timeout(self, timeout: Duration) -> SoapResult<Self>
pub fn timeout(self, timeout: Duration) -> SoapResult<Self>
Sets a non-zero request timeout.
Sourcepub fn body_limit(self, policy: BodyLimitPolicy) -> Self
pub fn body_limit(self, policy: BodyLimitPolicy) -> Self
Limits the encoded request body before extraction.
Sourcepub fn cors(self, policy: CorsPolicy) -> Self
pub fn cors(self, policy: CorsPolicy) -> Self
Sets the cross-origin policy.
Sourcepub const fn require_csrf(self) -> Self
pub const fn require_csrf(self) -> Self
Requires a CSRF adapter to validate the request.
Sourcepub fn security_headers(self, policy: SecurityHeadersPolicy) -> Self
pub fn security_headers(self, policy: SecurityHeadersPolicy) -> Self
Replaces the security response-header policy.
Sourcepub fn without_security_headers(self) -> Self
pub fn without_security_headers(self) -> Self
Explicitly delegates every security response header to the application.
Sourcepub fn response_cache(self, policy: ResponseCachePolicy) -> SoapResult<Self>
pub fn response_cache(self, policy: ResponseCachePolicy) -> SoapResult<Self>
Sets an HTTP response caching policy.
Sourcepub fn request_contract(self, contract: RequestContract) -> Self
pub fn request_contract(self, contract: RequestContract) -> Self
Adds or replaces a request contract for one location.
Sourcepub fn response_contract(self, contract: ResponseContract) -> Self
pub fn response_contract(self, contract: ResponseContract) -> Self
Adds or replaces a response contract for one status.
Sourcepub fn documentation(self, documentation: OperationDocumentation) -> Self
pub fn documentation(self, documentation: OperationDocumentation) -> Self
Replaces operation documentation.
Sourcepub fn telemetry(self, telemetry: TelemetryPolicy) -> Self
pub fn telemetry(self, telemetry: TelemetryPolicy) -> Self
Replaces endpoint telemetry instructions.
Sourcepub fn tag(self, tag: impl Into<String>) -> SoapResult<Self>
pub fn tag(self, tag: impl Into<String>) -> SoapResult<Self>
Adds a non-empty documentation tag once.
Sourcepub fn required_enforcement_capabilities(
&self,
) -> Vec<HttpEnforcementCapability>
pub fn required_enforcement_capabilities( &self, ) -> Vec<HttpEnforcementCapability>
Returns runtime enforcement that must be supplied by framework extensions before this endpoint can be served.
Body limits, deadlines, security response headers, and cache headers are translated directly by framework adapters. Telemetry remains observational and is therefore not an enforcement capability.
Sourcepub fn validate(&self) -> SoapResult<()>
pub fn validate(&self) -> SoapResult<()>
Validates invariants after direct public-field construction or mutation.
Trait Implementations§
Source§impl Clone for EndpointMetadata
impl Clone for EndpointMetadata
Source§fn clone(&self) -> EndpointMetadata
fn clone(&self) -> EndpointMetadata
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more