in src/main/java/com/awslabs/aws/greengrass/provisioner/implementations/helpers/BasicGroupUpdateHelper.java [62:110]
public void execute(UpdateArguments updateArguments) {
if (!updateArguments.addSubscription &&
!updateArguments.removeSubscription &&
(updateArguments.addDevice == null) &&
(updateArguments.removeDevice == null) &&
(updateArguments.addFunction == null) &&
(updateArguments.removeFunction == null)) {
throw new RuntimeException("No update specified");
}
GreengrassGroupName greengrassGroupName = ImmutableGreengrassGroupName.builder().groupName(updateArguments.groupName).build();
Optional<GroupInformation> optionalGroupInformation = v2GreengrassHelper.getGroupInformation(greengrassGroupName).findFirst();
if (!optionalGroupInformation.isPresent()) {
throw new RuntimeException(String.join("", "Group [", updateArguments.groupName, "] not found"));
}
if (updateArguments.addSubscription || updateArguments.removeSubscription) {
addOrRemoveSubscription(updateArguments, optionalGroupInformation.get());
return;
}
if (updateArguments.addDevice != null) {
addDevice(updateArguments, optionalGroupInformation.get());
return;
}
if (updateArguments.removeDevice != null) {
removeDevice(updateArguments, optionalGroupInformation.get());
return;
}
if (updateArguments.addFunction != null) {
addFunction(updateArguments, optionalGroupInformation.get());
return;
}
if (updateArguments.removeFunction != null) {
removeFunction(updateArguments, optionalGroupInformation.get());
return;
}
throw new RuntimeException("This should never happen. This is a bug.");
}