Struct SchemaDiscovery

Source
pub struct SchemaDiscovery<State = Ready> { /* private fields */ }
Expand description

Schema discovery component with state machine design.

The component uses phantom types to encode its configuration state at compile time, preventing invalid operations and ensuring proper initialization sequence. This component is specifically designed for schema discovery and service provider configuration, not for resource CRUD operations.

§Type Parameters

  • State - The current state of the component (Uninitialized or Ready)

§Example

use scim_server::SchemaDiscovery;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create a schema discovery component
    let discovery = SchemaDiscovery::new()?;

    // Get available schemas
    let schemas = discovery.get_schemas().await?;
    println!("Available schemas: {}", schemas.len());

    // For resource CRUD operations, use ScimServer instead
    Ok(())
}

Implementations§

Source§

impl SchemaDiscovery<Uninitialized>

Source

pub fn new() -> BuildResult<SchemaDiscovery<Ready>>

Create a new schema discovery component.

This creates a component with default configuration and schema registry for schema discovery and service provider configuration. For resource CRUD operations, use ScimServer instead.

Source§

impl SchemaDiscovery<Ready>

Source

pub async fn get_schemas(&self) -> ScimResult<Vec<Schema>>

Get all available schemas.

Returns the complete list of schemas supported by this component instance. For the MVP, this includes only the core User schema.

Source

pub async fn get_schema(&self, id: &str) -> ScimResult<Option<Schema>>

Get a specific schema by ID.

§Arguments
  • id - The schema identifier (URI)
§Returns
  • Some(Schema) if the schema exists
  • None if the schema is not found
Source

pub async fn get_service_provider_config( &self, ) -> ScimResult<ServiceProviderConfig>

Get the service provider configuration.

Returns the capabilities and configuration of this SCIM service provider as defined in RFC 7644.

Source

pub fn schema_registry(&self) -> &SchemaRegistry

Get the schema registry for advanced usage.

This provides access to the underlying schema registry for custom validation or schema introspection.

Source

pub fn service_config(&self) -> &ServiceProviderConfig

Get the service provider configuration.

Trait Implementations§

Source§

impl<State> Debug for SchemaDiscovery<State>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<State> Freeze for SchemaDiscovery<State>

§

impl<State> RefUnwindSafe for SchemaDiscovery<State>
where State: RefUnwindSafe,

§

impl<State> Send for SchemaDiscovery<State>
where State: Send,

§

impl<State> Sync for SchemaDiscovery<State>
where State: Sync,

§

impl<State> Unpin for SchemaDiscovery<State>
where State: Unpin,

§

impl<State> UnwindSafe for SchemaDiscovery<State>
where State: UnwindSafe,

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> 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> TenantValidator for T

Source§

fn validate_tenant_context( &self, expected_tenant_id: &str, context: &RequestContext, ) -> Result<(), String>

Validate that the context has the expected tenant.
Source§

fn validate_single_tenant_context( &self, context: &RequestContext, ) -> Result<(), String>

Validate that the context is for single-tenant operation.
Source§

fn require_tenant_context(&self, context: &RequestContext) -> Result<(), String>

Extract tenant context or return error for multi-tenant operations.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.