Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ crate-type = ["cdylib"]

[dependencies]
anyhow = "1.0.99"
atlas-local = { git = "https://github.com/mongodb/atlas-local-lib.git", rev = "323a879b8385e8e572f8545e3273fafa5698f8c6" }
atlas-local = { git = "https://github.com/mongodb/atlas-local-lib.git", rev = "fa7cb7aa67e9169f48864a81f3b63f1cf35c81bb" }
bollard = "0.19.2"
napi = { version = "3.0.0", features = ["async", "anyhow"] }
napi-derive = "3.0.0"
Expand Down
2 changes: 2 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export interface CreateDeploymentOptions {
name?: string
image?: string
mongodbVersion?: string
waitUntilHealthy?: boolean
waitUntilHealthyTimeout?: number
creationSource?: CreationSource
localSeedLocation?: string
mongodbInitdbDatabase?: string
Expand Down
16 changes: 15 additions & 1 deletion src/models/create_deployment.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::models::list_deployments::{CreationSource, MongoDBPortBinding};
use napi_derive::napi;
use semver::Version;
use std::time::Duration;

#[napi(object)]
pub struct CreateDeploymentOptions {
Expand All @@ -11,7 +12,9 @@ pub struct CreateDeploymentOptions {
pub image: Option<String>,
pub mongodb_version: Option<String>,

// Creation source
// Creation Options
pub wait_until_healthy: Option<bool>,
pub wait_until_healthy_timeout: Option<u32>,
pub creation_source: Option<CreationSource>,

// Initial database configuration
Expand Down Expand Up @@ -49,6 +52,10 @@ impl From<CreateDeploymentOptions> for atlas_local::models::CreateDeploymentOpti
name: source.name,
image: source.image,
mongodb_version: version,
wait_until_healthy: source.wait_until_healthy,
wait_until_healthy_timeout: source
.wait_until_healthy_timeout
.map(|timeout| Duration::from_secs(timeout as u64)),
creation_source: source
.creation_source
.map(atlas_local::models::CreationSource::from),
Expand Down Expand Up @@ -81,6 +88,8 @@ mod tests {
name: Some("test_deployment".to_string()),
image: Some("mongodb/mongodb-atlas-local".to_string()),
mongodb_version: Some("8.0.0".to_string()),
wait_until_healthy: Some(true),
wait_until_healthy_timeout: Some(30),
creation_source: Some(CreationSource {
source_type: CreationSourceType::MCPServer,
source: "MCPSERVER".to_string(),
Expand Down Expand Up @@ -115,6 +124,11 @@ mod tests {
lib_create_deployment_options.mongodb_version,
Some(Version::new(8, 0, 0))
);
assert_eq!(lib_create_deployment_options.wait_until_healthy, Some(true));
assert_eq!(
lib_create_deployment_options.wait_until_healthy_timeout,
Some(Duration::from_secs(30))
);
assert_eq!(
lib_create_deployment_options.creation_source,
Some(atlas_local::models::CreationSource::MCPServer)
Expand Down
Loading