Closed ButKor closed 1 year ago
This was actually left out on purpose as the named lookups of child entities is somewhat ambiguous. For example adding a child asset, the child could either be a devicegroup, device, managed object...so doing a named lookup might find some unexpected results.
One proposal would be to use multiple flags to set the same value, for example --childdevice
would lookup devices by name, whereas --childgroup
would lookup a device group. But both flags would be mapped to the same output value, so ideally these flags would be mutually exclusive.
# child lookup for devices
c8y devices children assign --id device_1 --childdevice device_2 --childType device
# child lookup for device groups
c8y devices children assign --id device_1 --childgroup device_2 --childType device
# child with no named lookups
c8y devices children assign --id device_1 --childasset device_2 --childType device
The other option would be support an generic "lookup" syntax, e.g. --child devicegroup::<name>
, where devicegroup::
would tell what kind of lookup should be used...though I think there are a lot of other aspects to this proposal, so that would take longer to implement.
Well...to be honest I thought it was simply forgotten ;-) Your explanation makes sense. I would also be happy with closing this one (and maybe adding a note to the docs).
Currently reference-by-name seems not to be supported for:
Reference by name concept is already existing for e.g.
c8y devices get --id {name}
andc8y devicegroups get --id {name}
- so I would think it can also be added to this subcommand?Here's an example: