use std::sync::Arc;
use crate::service::instance::{cfn_boot_instance, cfn_create_instance, cfn_terminate_instance};
use crate::{Ec2Runtime, Ec2Service, SharedEc2State};
pub use crate::service::instance::{CfnInstanceAttrs, CfnInstanceSpec};
pub fn cfn_create(
state: SharedEc2State,
account_id: &str,
region: &str,
spec: &CfnInstanceSpec,
) -> CfnInstanceAttrs {
let svc = Ec2Service::with_state(state);
cfn_create_instance(&svc, account_id, region, spec)
}
pub async fn cfn_back_instance(
state: SharedEc2State,
runtime: Option<Arc<Ec2Runtime>>,
account_id: String,
instance_id: String,
) {
let svc = Ec2Service::with_state(state).with_runtime(runtime);
cfn_boot_instance(&svc, &account_id, &instance_id).await;
}
pub async fn cfn_terminate(
state: SharedEc2State,
runtime: Option<Arc<Ec2Runtime>>,
account_id: String,
region: String,
instance_id: String,
) {
let svc = Ec2Service::with_state(state).with_runtime(runtime);
cfn_terminate_instance(&svc, &account_id, ®ion, &instance_id).await;
}