/** * {@inheritDoc} */ @Override public Input remove(String key) { Input input = retrieveInput(key); if (input != null) { input.remove(); } return input; }
/** * {@inheritDoc} * * Overrides the {@code update} method to additionally update this input's * path if the {@code RestrictToHost} property is changed. */ @Override public void update(Map<String, Object> args) { if (args.containsKey("restrictToHost")) { throw new UnsupportedOperationException( "You cannot update the restrictToHost parameter " + "on an existing input with the SDK."); } else { super.update(args); } } }
private Input retrieveInput(String key) { validate(); // Because scripted input names are not 1:1 with the original name // (they are the absolute path on the Splunk instance followed by // the original name), we will iterate over the entities in the list, // and if we find one that matches, return it. Set<Entry<String, LinkedList<Input>>> set = items.entrySet(); for (Entry<String, LinkedList<Input>> entry: set) { String entryKey = entry.getKey(); LinkedList<Input> entryValue = entry.getValue(); InputKind kind = entryValue.get(0).getKind(); if (InputCollection.matchesInputName(kind, key, entryKey)) { if (entryValue.size() > 1) { throw new SplunkException(SplunkException.AMBIGUOUS, "Multiple inputs matched " + key + "; specify a namespace to disambiguate."); } else { return entryValue.get(0); } } } return null; }
private Input retrieveInput(String key, Args namespace) { Util.ensureNamespaceIsExact(namespace); validate(); // Because scripted input names are not 1:1 with the original name // (they are the absolute path on the Splunk instance followed by // the original name), we will iterate over the entities in the list, // and if we find one that matches, return it. String pathMatcher = service.fullpath("", namespace); Set<Entry<String, LinkedList<Input>>> set = items.entrySet(); for (Entry<String, LinkedList<Input>> entry: set) { String entryKey = entry.getKey(); LinkedList<Input> entryValue = entry.getValue(); InputKind kind = entryValue.get(0).getKind(); if (InputCollection.matchesInputName(kind, key, entryKey)) { for (Input entity: entryValue) { if (entity.path.startsWith(pathMatcher)) { return entity; } } } } return null; } }
/** * {@inheritDoc} */ @Override public void update() { // If not present in the update keys, add required attribute as long // as one pre-existing update pair exists if (toUpdate.size() > 0 && !toUpdate.containsKey("lookup_host")) { setCacheValue("lookup_host", getLookupHost()); } super.update(); } }
/** * {@inheritDoc} */ @Override public Input remove( String key, Args namespace) { Util.ensureNamespaceIsExact(namespace); Input input = retrieveInput(key, namespace); if (input != null) { input.remove(); } return input; }
/** * {@inheritDoc} */ @Override public void update() { // If not present in the update keys, add required attribute as long // as one pre-existing update pair exists if (toUpdate.size() > 0 && !toUpdate.containsKey("monitorSubtree")) { setCacheValue( "monitorSubtree", getMonitorSubtree()); } super.update(); } }
/** * {@inheritDoc} */ @Override public void update(Map<String, Object> args) { // Add required arguments if not already present if (!args.containsKey("lookup_host")) { args = Args.create(args).add("lookup_host", getLookupHost()); } super.update(args); }
/** * {@inheritDoc} */ @Override public void update(Map<String, Object> args) { // Add required arguments if not already present if (!args.containsKey("monitorSubtree")) { args = Args.create(args).add( "monitorSubtree", getMonitorSubtree()); } super.update(args); }
/** * {@inheritDoc} */ @Override public void update() { // If not present in the update keys, add required attributes as long // as one pre-existing update pair exists if (toUpdate.size() > 0 && !toUpdate.containsKey("classes")) { setCacheValue("classes", getClasses()); } if (toUpdate.size() > 0 && !toUpdate.containsKey("interval")) { setCacheValue("interval", getInterval()); } if (toUpdate.size() > 0 && !toUpdate.containsKey("lookup_host")) { setCacheValue("lookup_host", getLookupHost()); } super.update(); } }
/** * {@inheritDoc} */ @Override public void update() { // If not present in the update keys, add required attributes as long // as one pre-existing update pair exists if (toUpdate.size() > 0 && !toUpdate.containsKey("baseline")) { setCacheValue("baseline", getBaseline()); } if (toUpdate.size() > 0 && !toUpdate.containsKey("hive")) { setCacheValue("hive", getHive()); } if (toUpdate.size() > 0 && !toUpdate.containsKey("proc")) { setCacheValue("proc", getProc()); } if (toUpdate.size() > 0 && !toUpdate.containsKey("type")) { setCacheValue("type", Util.join("|", getType())); } super.update(); } }
/** * {@inheritDoc} */ @Override public void update(Map<String, Object> args) { // If not present in the update keys, add required attributes if (!args.containsKey("classes")) args = Args.create(args).add("classes", getClasses()); if (!args.containsKey("interval")) args = Args.create(args).add("interval", getInterval()); if (!args.containsKey("lookup_host")) args = Args.create(args).add( "lookup_host", getLookupHost()); super.update(args); }
/** * {@inheritDoc} */ @Override public void update(Map<String, Object> args) { // Add required arguments if not already present if (!args.containsKey("baseline")) { args = Args.create(args).add("baseline", getBaseline()); } if (!args.containsKey("hive")) { args = Args.create(args).add("hive", getHive()); } if (!args.containsKey("proc")) { args = Args.create(args).add("proc", getProc()); } if (!args.containsKey("type")) { args = Args.create(args).add("type", Util.join("|", getType())); } super.update(args); }