Parameters Recall
./envman init demo --type development azriel91/web_app 0.1.1
# For good user experience, parameters
# should not have to be passed in on
# every command invocation
./envman status # demo --type development azriel91/web_app 0.1.1
./envman deploy # demo --type development azriel91/web_app 0.1.1
We need to store and load the parameters passed in previously.
First command invocation:
// examples/envman/src/cmds/profile_init_cmd.rs
// fn app_upload_flow_init
cmd_ctx_builder
.with_profile_from_workspace_param(profile_key)
.with_flow(flow)
.with_item_params::<FileDownloadItem<WebApp>>(
item_id!("app_download"),
app_download_params_spec,
)
.with_item_params::<S3BucketItem<WebApp>>(
item_id!("s3_bucket"),
s3_bucket_params_spec,
)
.with_item_params::<S3ObjectItem<WebApp>>(
item_id!("s3_object"),
s3_object_params_spec,
)
.await?
Subsequent command invocations:
// examples/envman/src/cmds/app_upload_cmd.rs
cmd_ctx_builder
.with_profile_from_workspace_param(&profile_key)
.with_flow(&flow)
// * file_download params spec not specified
// * s3_bucket params spec not specified
.with_item_params::<S3ObjectItem<WebApp>>(
item_id!("s3_object"),
s3_object_params_spec,
)
.await?
let s3_object_params_spec = S3ObjectParams::<WebApp>::field_wise_spec()
// Note:
//
// * file_path not specified
// * object key not specified
// * Function logic cannot be deserialized,
// so needs to be provided
.with_bucket_name_from_map(|s3_bucket_state: &S3BucketState| {
match s3_bucket_state {
S3BucketState::None => None,
S3BucketState::Some {
name,
creation_date: _,
} => Some(name.clone()),
}
})
.build();