use std::{fs::File, io::Write, path::Path}; use serde::{Deserialize, Serialize}; use concourse_resource::*; struct HelloWorld {} #[derive(Serialize, Deserialize)] struct Version { ver: String, } impl Resource for HelloWorld { type Version = Version; type Source = concourse_resource::Empty; type InParams = concourse_resource::Empty; type InMetadata = concourse_resource::Empty; type OutParams = concourse_resource::Empty; type OutMetadata = concourse_resource::Empty; fn resource_check(_: Option, _: Option) -> Vec { vec![Self::Version { ver: String::from("static"), }] } fn resource_in( _source: Option, _version: Self::Version, _params: Option, output_path: &str, ) -> Result, Box> { let mut path = Path::new(output_path).to_path_buf(); path.push("hello_world.txt"); let mut file = File::create(path)?; file.write_all(b"hello, world!")?; Ok(InOutput { version: Self::Version { ver: String::from("static"), }, metadata: None, }) } fn resource_out( _: Option, _: Option, _: &str, ) -> OutOutput { unimplemented!() } } create_resource!(HelloWorld);