ModifyImageAttributeType miat = modifyImageAttribute.getModifyImageAttribute();
ModifyImageAttributeTypeChoice_type0 item = miat.getModifyImageAttributeTypeChoice_type0();
AttributeValueType description = item.getDescription();
LaunchPermissionOperationType launchPermOp = item.getLaunchPermission();
if (null != description) {
request.setImageId(miat.getImageId());
request.setAttribute(ImageAttribute.description);
request.setDescription(description.getValue());
return toModifyImageAttributeResponse(engine.modifyImageAttribute(request));
} else if (launchPermOp != null) {
request.setImageId(miat.getImageId());
request.setAttribute(ImageAttribute.launchPermission);
if (launchPermOp.getAdd() != null) {
setAccountOrGroupList(launchPermOp.getAdd().getItem(), request, "add");
} else if (launchPermOp.getRemove() != null) {
setAccountOrGroupList(launchPermOp.getRemove().getItem(), request, "remove");
}
return toModifyImageAttributeResponse(engine.modifyImageAttribute(request));
}
throw new EC2ServiceException(ClientError.Unsupported, "Unsupported - can only modify image description or launchPermission");
}