1
1
use crate :: models:: list_deployments:: { CreationSource , MongoDBPortBinding } ;
2
2
use napi_derive:: napi;
3
3
use semver:: Version ;
4
+ use std:: time:: Duration ;
4
5
5
6
#[ napi( object) ]
6
7
pub struct CreateDeploymentOptions {
@@ -11,7 +12,9 @@ pub struct CreateDeploymentOptions {
11
12
pub image : Option < String > ,
12
13
pub mongodb_version : Option < String > ,
13
14
14
- // Creation source
15
+ // Creation Options
16
+ pub wait_until_healthy : Option < bool > ,
17
+ pub wait_until_healthy_timeout : Option < u32 > ,
15
18
pub creation_source : Option < CreationSource > ,
16
19
17
20
// Initial database configuration
@@ -49,6 +52,10 @@ impl From<CreateDeploymentOptions> for atlas_local::models::CreateDeploymentOpti
49
52
name : source. name ,
50
53
image : source. image ,
51
54
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 ) ) ,
52
59
creation_source : source
53
60
. creation_source
54
61
. map ( atlas_local:: models:: CreationSource :: from) ,
@@ -81,6 +88,8 @@ mod tests {
81
88
name : Some ( "test_deployment" . to_string ( ) ) ,
82
89
image : Some ( "mongodb/mongodb-atlas-local" . to_string ( ) ) ,
83
90
mongodb_version : Some ( "8.0.0" . to_string ( ) ) ,
91
+ wait_until_healthy : Some ( true ) ,
92
+ wait_until_healthy_timeout : Some ( 30 ) ,
84
93
creation_source : Some ( CreationSource {
85
94
source_type : CreationSourceType :: MCPServer ,
86
95
source : "MCPSERVER" . to_string ( ) ,
@@ -115,6 +124,11 @@ mod tests {
115
124
lib_create_deployment_options. mongodb_version,
116
125
Some ( Version :: new( 8 , 0 , 0 ) )
117
126
) ;
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
+ ) ;
118
132
assert_eq ! (
119
133
lib_create_deployment_options. creation_source,
120
134
Some ( atlas_local:: models:: CreationSource :: MCPServer )
0 commit comments