pub async fn add_hw_component(
infra: &InfraContext<'_>,
shasta_token: &str,
target_group_name: &str,
parent_group_name: &str,
pattern: &str,
dryrun: bool,
create_group: bool,
) -> Result<AddHwResult, Error>Expand description
Move enough nodes out of parent_group_name into
target_group_name to add the components described by
pattern (<component>:<delta> pairs) to the target.
The target group is created on demand when create_group is
set; missing it otherwise yields NotFound. The parent group’s
post-move hw component summary is computed up front so the
algorithm can reject patterns that would over-draw the parent
(InsufficientResources). Selection uses scarcity-weighted scores
so common components get pulled first and rare ones are preserved.
In dryrun mode the planned move is returned without any backend
mutation.
§Errors
- [
Error::NotFound] when the target group is missing andcreate_groupis false. - [
Error::BadRequest] for a dry-run that would otherwise create the missing target group. - [
Error::InvalidPattern] whenpatterncannot be parsed. - [
Error::InsufficientResources] when removing any component would over-draw the parent group. - [
Error::NetError] / [Error::CsmError] from the backend group / inventory / membership calls.