pub struct Workspace {
pub id: EntityId,
pub name: String,
pub description: Option<String>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
pub tags: Vec<String>,
pub config: WorkspaceConfig,
pub folders: Vec<Folder>,
pub requests: Vec<MockRequest>,
pub order: i32,
}Expand description
Workspace represents a top-level organizational unit
Fields§
§id: EntityIdUnique identifier
name: StringHuman-readable name
description: Option<String>Optional description
created_at: DateTime<Utc>Creation timestamp
updated_at: DateTime<Utc>Last modification timestamp
Associated tags for filtering and organization
config: WorkspaceConfigConfiguration specific to this workspace
folders: Vec<Folder>Root folders in this workspace
requests: Vec<MockRequest>Root requests (not in any folder)
order: i32Display order for UI sorting (lower numbers appear first)
Implementations§
Source§impl Workspace
impl Workspace
Sourcepub fn initialize_default_mock_environments(&mut self)
pub fn initialize_default_mock_environments(&mut self)
Initialize default mock environments for this workspace This is called when creating a new workspace or when loading an existing one that doesn’t have mock environments configured
Sourcepub fn add_folder(&mut self, name: String) -> Result<EntityId>
pub fn add_folder(&mut self, name: String) -> Result<EntityId>
Add a folder to this workspace
Sourcepub fn create_environment(
&mut self,
name: String,
description: Option<String>,
) -> Result<EntityId>
pub fn create_environment( &mut self, name: String, description: Option<String>, ) -> Result<EntityId>
Create a new environment
Sourcepub fn get_environments(&self) -> Vec<&Environment>
pub fn get_environments(&self) -> Vec<&Environment>
Get all environments (global + sub-environments)
Sourcepub fn get_environment(&self, id: &str) -> Option<&Environment>
pub fn get_environment(&self, id: &str) -> Option<&Environment>
Get environment by ID
Sourcepub fn get_environment_mut(&mut self, id: &str) -> Option<&mut Environment>
pub fn get_environment_mut(&mut self, id: &str) -> Option<&mut Environment>
Get environment by ID (mutable)
Sourcepub fn set_active_environment(
&mut self,
environment_id: Option<String>,
) -> Result<()>
pub fn set_active_environment( &mut self, environment_id: Option<String>, ) -> Result<()>
Set active environment
Sourcepub fn get_active_environment(&self) -> &Environment
pub fn get_active_environment(&self) -> &Environment
Get active environment (returns global if no sub-environment is active)
Sourcepub fn get_active_environment_id(&self) -> Option<&str>
pub fn get_active_environment_id(&self) -> Option<&str>
Get active environment ID
Sourcepub fn get_variable(&self, key: &str) -> Option<&String>
pub fn get_variable(&self, key: &str) -> Option<&String>
Get variable value from current active environment
Sourcepub fn get_all_variables(&self) -> HashMap<String, String>
pub fn get_all_variables(&self) -> HashMap<String, String>
Get all variables from current active environment context
Sourcepub fn delete_environment(&mut self, id: &str) -> Result<()>
pub fn delete_environment(&mut self, id: &str) -> Result<()>
Delete an environment
Sourcepub fn update_environments_order(
&mut self,
environment_ids: Vec<String>,
) -> Result<()>
pub fn update_environments_order( &mut self, environment_ids: Vec<String>, ) -> Result<()>
Update the order of environments
Sourcepub fn get_environments_ordered(&self) -> Vec<&Environment>
pub fn get_environments_ordered(&self) -> Vec<&Environment>
Get environments sorted by order
Sourcepub fn get_mock_environments(&self) -> &MockEnvironmentManager
pub fn get_mock_environments(&self) -> &MockEnvironmentManager
Get the mock environment manager
Sourcepub fn get_mock_environments_mut(&mut self) -> &mut MockEnvironmentManager
pub fn get_mock_environments_mut(&mut self) -> &mut MockEnvironmentManager
Get mutable access to the mock environment manager
Sourcepub fn get_mock_environment(
&self,
name: MockEnvironmentName,
) -> Option<&MockEnvironment>
pub fn get_mock_environment( &self, name: MockEnvironmentName, ) -> Option<&MockEnvironment>
Get a specific mock environment by name
Sourcepub fn get_active_mock_environment(&self) -> Option<&MockEnvironment>
pub fn get_active_mock_environment(&self) -> Option<&MockEnvironment>
Get the active mock environment
Sourcepub fn set_active_mock_environment(
&mut self,
name: MockEnvironmentName,
) -> Result<()>
pub fn set_active_mock_environment( &mut self, name: MockEnvironmentName, ) -> Result<()>
Set the active mock environment
Sourcepub fn list_mock_environments(&self) -> Vec<&MockEnvironment>
pub fn list_mock_environments(&self) -> Vec<&MockEnvironment>
List all mock environments
Sourcepub fn set_mock_environment_config(
&mut self,
name: MockEnvironmentName,
reality_config: Option<RealityConfig>,
chaos_config: Option<ChaosConfig>,
drift_budget_config: Option<DriftBudgetConfig>,
) -> Result<()>
pub fn set_mock_environment_config( &mut self, name: MockEnvironmentName, reality_config: Option<RealityConfig>, chaos_config: Option<ChaosConfig>, drift_budget_config: Option<DriftBudgetConfig>, ) -> Result<()>
Add or update a mock environment configuration
Sourcepub fn configure_sync(&mut self, config: SyncConfig) -> Result<()>
pub fn configure_sync(&mut self, config: SyncConfig) -> Result<()>
Configure directory sync for this workspace
Sourcepub fn enable_sync(&mut self, target_directory: String) -> Result<()>
pub fn enable_sync(&mut self, target_directory: String) -> Result<()>
Enable directory sync with default settings
Sourcepub fn disable_sync(&mut self) -> Result<()>
pub fn disable_sync(&mut self) -> Result<()>
Disable directory sync
Sourcepub fn get_sync_config(&self) -> &SyncConfig
pub fn get_sync_config(&self) -> &SyncConfig
Get sync configuration
Sourcepub fn is_sync_enabled(&self) -> bool
pub fn is_sync_enabled(&self) -> bool
Check if sync is enabled
Sourcepub fn get_sync_directory(&self) -> Option<&str>
pub fn get_sync_directory(&self) -> Option<&str>
Get the target sync directory
Sourcepub fn set_sync_directory(&mut self, directory: Option<String>) -> Result<()>
pub fn set_sync_directory(&mut self, directory: Option<String>) -> Result<()>
Set sync directory
Sourcepub fn set_sync_direction(&mut self, direction: SyncDirection) -> Result<()>
pub fn set_sync_direction(&mut self, direction: SyncDirection) -> Result<()>
Set sync direction
Sourcepub fn get_sync_direction(&self) -> &SyncDirection
pub fn get_sync_direction(&self) -> &SyncDirection
Get sync direction
Sourcepub fn set_realtime_monitoring(&mut self, enabled: bool) -> Result<()>
pub fn set_realtime_monitoring(&mut self, enabled: bool) -> Result<()>
Enable/disable real-time monitoring
Sourcepub fn is_realtime_monitoring_enabled(&self) -> bool
pub fn is_realtime_monitoring_enabled(&self) -> bool
Check if real-time monitoring is enabled
Sourcepub fn to_filtered_for_sync(&self) -> Workspace
pub fn to_filtered_for_sync(&self) -> Workspace
Create filtered copy for directory sync (removes sensitive environments and non-sharable environments)
Sourcepub fn should_sync(&self) -> bool
pub fn should_sync(&self) -> bool
Check if this workspace should be included in directory sync
Sourcepub fn get_sync_filename(&self) -> String
pub fn get_sync_filename(&self) -> String
Get the filename for this workspace in directory sync
Source§impl Workspace
impl Workspace
Sourcepub fn find_folder(&self, id: &str) -> Option<&Folder>
pub fn find_folder(&self, id: &str) -> Option<&Folder>
Find a folder by ID recursively
Sourcepub fn find_folder_mut(&mut self, id: &str) -> Option<&mut Folder>
pub fn find_folder_mut(&mut self, id: &str) -> Option<&mut Folder>
Find a folder by ID recursively (mutable)
Sourcepub fn add_request(&mut self, request: MockRequest) -> Result<EntityId>
pub fn add_request(&mut self, request: MockRequest) -> Result<EntityId>
Add a request to this workspace
Sourcepub fn get_routes(&self) -> Vec<Route>
pub fn get_routes(&self) -> Vec<Route>
Get all routes from this workspace
Sourcepub fn get_effective_auth<'a>(
&'a self,
folder_path: &[&'a Folder],
) -> Option<&'a AuthConfig>
pub fn get_effective_auth<'a>( &'a self, folder_path: &[&'a Folder], ) -> Option<&'a AuthConfig>
Get effective authentication for a request at the given path
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Workspace
impl<'de> Deserialize<'de> for Workspace
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>,
Auto Trait Implementations§
impl Freeze for Workspace
impl RefUnwindSafe for Workspace
impl Send for Workspace
impl Sync for Workspace
impl Unpin for Workspace
impl UnsafeUnpin for Workspace
impl UnwindSafe for Workspace
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§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more