11use crate :: models:: list_deployments:: { CreationSource , MongoDBPortBinding } ;
22use napi_derive:: napi;
33use semver:: Version ;
4+ use std:: time:: Duration ;
45
56#[ napi( object) ]
67pub struct CreateDeploymentOptions {
@@ -11,7 +12,9 @@ pub struct CreateDeploymentOptions {
1112 pub image : Option < String > ,
1213 pub mongodb_version : Option < String > ,
1314
14- // Creation source
15+ // Creation Options
16+ pub wait_until_healthy : Option < bool > ,
17+ pub wait_until_healthy_timeout : Option < u32 > ,
1518 pub creation_source : Option < CreationSource > ,
1619
1720 // Initial database configuration
@@ -49,6 +52,10 @@ impl From<CreateDeploymentOptions> for atlas_local::models::CreateDeploymentOpti
4952 name : source. name ,
5053 image : source. image ,
5154 mongodb_version : version,
55+ wait_until_healthy : source. wait_until_healthy ,
56+ wait_until_healthy_timeout : source
57+ . wait_until_healthy_timeout
58+ . map ( |timeout| Duration :: from_secs ( timeout as u64 ) ) ,
5259 creation_source : source
5360 . creation_source
5461 . map ( atlas_local:: models:: CreationSource :: from) ,
@@ -81,6 +88,8 @@ mod tests {
8188 name : Some ( "test_deployment" . to_string ( ) ) ,
8289 image : Some ( "mongodb/mongodb-atlas-local" . to_string ( ) ) ,
8390 mongodb_version : Some ( "8.0.0" . to_string ( ) ) ,
91+ wait_until_healthy : Some ( true ) ,
92+ wait_until_healthy_timeout : Some ( 30 ) ,
8493 creation_source : Some ( CreationSource {
8594 source_type : CreationSourceType :: MCPServer ,
8695 source : "MCPSERVER" . to_string ( ) ,
@@ -115,6 +124,11 @@ mod tests {
115124 lib_create_deployment_options. mongodb_version,
116125 Some ( Version :: new( 8 , 0 , 0 ) )
117126 ) ;
127+ assert_eq ! ( lib_create_deployment_options. wait_until_healthy, Some ( true ) ) ;
128+ assert_eq ! (
129+ lib_create_deployment_options. wait_until_healthy_timeout,
130+ Some ( Duration :: from_secs( 30 ) )
131+ ) ;
118132 assert_eq ! (
119133 lib_create_deployment_options. creation_source,
120134 Some ( atlas_local:: models:: CreationSource :: MCPServer )
0 commit comments