#![deny(missing_docs)]
use crate::NifiError;
#[cfg(not(feature = "dynamic"))]
use crate::types::{
ActivateControllerServicesEntity, ActivateControllerServicesEntityState,
ScheduleComponentsEntity, ScheduleComponentsEntityState,
};
#[cfg(not(feature = "dynamic"))]
pub async fn start_process_group(
client: &crate::NifiClient,
group_id: &str,
) -> Result<ScheduleComponentsEntity, NifiError> {
let body = ScheduleComponentsEntity {
id: Some(group_id.to_string()),
state: Some(ScheduleComponentsEntityState::Running),
..Default::default()
};
client.flow().schedule_components(group_id, &body).await
}
#[cfg(not(feature = "dynamic"))]
pub async fn stop_process_group(
client: &crate::NifiClient,
group_id: &str,
) -> Result<ScheduleComponentsEntity, NifiError> {
let body = ScheduleComponentsEntity {
id: Some(group_id.to_string()),
state: Some(ScheduleComponentsEntityState::Stopped),
..Default::default()
};
client.flow().schedule_components(group_id, &body).await
}
#[cfg(not(feature = "dynamic"))]
pub async fn enable_all_controller_services(
client: &crate::NifiClient,
group_id: &str,
) -> Result<ActivateControllerServicesEntity, NifiError> {
let body = ActivateControllerServicesEntity {
id: Some(group_id.to_string()),
state: Some(ActivateControllerServicesEntityState::Enabled),
..Default::default()
};
client
.flow()
.activate_controller_services(group_id, &body)
.await
}
#[cfg(not(feature = "dynamic"))]
pub async fn disable_all_controller_services(
client: &crate::NifiClient,
group_id: &str,
) -> Result<ActivateControllerServicesEntity, NifiError> {
let body = ActivateControllerServicesEntity {
id: Some(group_id.to_string()),
state: Some(ActivateControllerServicesEntityState::Disabled),
..Default::default()
};
client
.flow()
.activate_controller_services(group_id, &body)
.await
}
#[cfg(feature = "dynamic")]
use crate::dynamic::types::{
ActivateControllerServicesEntity, ActivateControllerServicesEntityState,
ScheduleComponentsEntity, ScheduleComponentsEntityState,
};
#[cfg(feature = "dynamic")]
pub async fn start_process_group_dynamic(
client: &crate::dynamic::DynamicClient,
group_id: &str,
) -> Result<ScheduleComponentsEntity, NifiError> {
let body = ScheduleComponentsEntity {
id: Some(group_id.to_string()),
state: Some(ScheduleComponentsEntityState::Running.into()),
..Default::default()
};
client.flow().schedule_components(group_id, &body).await
}
#[cfg(feature = "dynamic")]
pub async fn stop_process_group_dynamic(
client: &crate::dynamic::DynamicClient,
group_id: &str,
) -> Result<ScheduleComponentsEntity, NifiError> {
let body = ScheduleComponentsEntity {
id: Some(group_id.to_string()),
state: Some(ScheduleComponentsEntityState::Stopped.into()),
..Default::default()
};
client.flow().schedule_components(group_id, &body).await
}
#[cfg(feature = "dynamic")]
pub async fn enable_all_controller_services_dynamic(
client: &crate::dynamic::DynamicClient,
group_id: &str,
) -> Result<ActivateControllerServicesEntity, NifiError> {
let body = ActivateControllerServicesEntity {
id: Some(group_id.to_string()),
state: Some(ActivateControllerServicesEntityState::Enabled.into()),
..Default::default()
};
client
.flow()
.activate_controller_services(group_id, &body)
.await
}
#[cfg(feature = "dynamic")]
pub async fn disable_all_controller_services_dynamic(
client: &crate::dynamic::DynamicClient,
group_id: &str,
) -> Result<ActivateControllerServicesEntity, NifiError> {
let body = ActivateControllerServicesEntity {
id: Some(group_id.to_string()),
state: Some(ActivateControllerServicesEntityState::Disabled.into()),
..Default::default()
};
client
.flow()
.activate_controller_services(group_id, &body)
.await
}