#[cfg(feature = "dynamic")]
fn main() {
eprintln!(
"bulk_start_stop requires a single-version feature, not `dynamic`. The dynamic equivalents are bulk::start_process_group_dynamic / bulk::stop_process_group_dynamic."
);
}
#[cfg(not(feature = "dynamic"))]
use nifi_rust_client::NifiClientBuilder;
#[cfg(not(feature = "dynamic"))]
use nifi_rust_client::bulk;
#[cfg(not(feature = "dynamic"))]
use nifi_rust_client::config::auth::EnvPasswordAuth;
#[cfg(not(feature = "dynamic"))]
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
tracing_subscriber::fmt()
.with_env_filter(
tracing_subscriber::EnvFilter::try_from_default_env()
.unwrap_or_else(|_| "nifi_rust_client=info".into()),
)
.init();
let pg_id = std::env::args().nth(1).expect("usage: <process-group-id>");
let url = std::env::var("NIFI_URL").unwrap_or_else(|_| "https://localhost:8443".into());
let client = NifiClientBuilder::new(&url)?
.danger_accept_invalid_certs(true)
.auth_provider(EnvPasswordAuth::new())
.build()?;
client.authenticate().await?;
bulk::start_process_group(&client, &pg_id).await?;
eprintln!("started process group {pg_id}");
bulk::stop_process_group(&client, &pg_id).await?;
eprintln!("stopped process group {pg_id}");
Ok(())
}