This is an SDK for Kurtosis, based on the protobufs available here;
Make sure that the engine is running:
terminal
kurtosis engine start
Then you can run a Starlark script using Kurtosis+Rust:
```rust use kurtosissdk::{engineapi::{engineserviceclient::{EngineServiceClient}, CreateEnclaveArgs}, enclaveapi::{apicontainerserviceclient::ApiContainerServiceClient, RunStarlarkScriptArgs}}; use kurtosissdk::enclaveapi::starlarkrunresponse_line::RunResponseLine::InstructionResult;
const STARLARK_SCRIPT : &str = " def main(plan): plan.print('Hello World!') ";
async fn main() -> Result<(), Box
// CONNECT TO ENCLAVE
let enclave_port = create_enclave_response.enclave_info.expect("Enclave info must be present").api_container_host_machine_info.expect("Enclave host machine info must be present").grpc_port_on_host_machine;
let mut enclave = ApiContainerServiceClient::connect(format!("https://[::1]:{}", enclave_port)).await?;
// RUN STARLARK SCRIPT
let mut run_result = enclave.run_starlark_script(RunStarlarkScriptArgs{
serialized_script: STARLARK_SCRIPT.to_string(),
serialized_params: "{}".to_string(),
dry_run: Option::Some(false),
parallelism: Option::None,
main_function_name: "main".to_string(),
}).await?.into_inner();
// GET OUTPUT LINES
while let Some(next_message) = run_result.message().await? {
next_message.run_response_line.map(|line| match line {
InstructionResult(result) => {
println!("{}", result.serialized_instruction_result)
}
_ => (),
});
}
Ok(())
}
```
More details can be found on the docs.