Skip to main content

RpcCrudGrouper

Struct RpcCrudGrouper 

Source
pub struct RpcCrudGrouper { /* private fields */ }
Expand description

Configurable grouper for RPC-style CRUD APIs.

Unlike REST APIs where the HTTP method determines the CRUD verb, RPC APIs encode the verb in the path or operation ID. This grouper uses configurable patterns to detect verbs and group endpoints by resource name.

§Example

use openapi_forge::{RpcCrudGrouper, RpcCrudVerb, RpcPattern};

let grouper = RpcCrudGrouper::new()
    .pattern(RpcPattern::new(
        RpcCrudVerb::Create,
        "/create-{resource}",
        "{0}",
    ))
    .pattern(RpcPattern::new(
        RpcCrudVerb::Delete,
        "/delete-{resource}",
        "{0}",
    ));

Implementations§

Source§

impl RpcCrudGrouper

Source

pub fn new() -> Self

Create a new empty grouper with no patterns.

Source

pub fn pattern(self, pat: RpcPattern) -> Self

Add a pattern to this grouper. Patterns are tried in order; first match wins.

Source

pub fn patterns(self, pats: Vec<RpcPattern>) -> Self

Add multiple patterns at once.

Source

pub fn default_patterns() -> Self

Create a grouper with default patterns for common RPC APIs.

Handles create-X, get-X, update-X, delete-X, list-X, describe-X, add-X, remove-X patterns.

Source

pub fn akeyless_patterns() -> Self

Create a grouper with Akeyless-specific patterns.

Handles all the Akeyless API naming conventions:

  • Auth methods: auth-method-create-X, create-auth-method-X
  • Targets: target-create-X, create-X-target
  • Dynamic secrets: dynamic-secret-create-X, create-dynamic-secret
  • Rotated secrets: rotated-secret-create-X, create-rotated-secret
  • Gateway producers: gateway-create-producer-X, gateway-update-producer-X
  • Static secrets: create-secret, get-secret-value, etc.
  • Items: describe-item, delete-item, list-items
Source

pub fn group(&self, endpoints: &[Endpoint]) -> Vec<CrudGroup>

Group the given endpoints into CRUD groups using the configured patterns.

Each endpoint’s path is tested against the patterns in order. The first matching pattern determines the verb and group name.

Source

pub fn group_spec(&self, spec: &Spec) -> Vec<CrudGroup>

Group endpoints directly from a Spec.

Trait Implementations§

Source§

impl Clone for RpcCrudGrouper

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RpcCrudGrouper

Source§

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

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

impl Default for RpcCrudGrouper

Source§

fn default() -> Self

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

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

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.