/** * Creates an entity in this collection. * * @param name The name of the entity. * @return The entity. */ public T create(String name) { return create(name, (Map)null); }
/** * Creates an entity in this collection. * * @param name The name of the entity. * @param args Arguments for creating the entity. * @return The entity. */ @Override public DataModel create(String name, Map args) { Args revisedArgs = Args.create(args); // concise=0 forces the server to return all details of the newly // created data model. if (!args.containsKey("concise")) { revisedArgs = revisedArgs.add("concise", "0"); } return super.create(name, revisedArgs); } }
/** * Uploads a file to this index as an event stream. * <p> * <b>Note:</b> This file must be directly accessible by the Splunk server. * * @param filename The path and filename. */ public void upload(String filename) { EntityCollection<Upload> uploads = service.getUploads(); Args args = new Args("index", getName()); uploads.create(filename, args); }
/** * Uploads a file to this index as an event stream. * <p> * <b>Note:</b> This file must be directly accessible by the Splunk server. * * @param filename The path and filename. * * @param args Optional arguments for this request. Valid parameters are: * "host", "sourcetype", "rename-source". More found at: * http://docs.splunk.com/Documentation/Splunk/latest/RESTAPI/RESTinput#data.2Finputs.2Foneshot * */ public void upload(String filename, Args args) { EntityCollection<Upload> uploads = service.getUploads(); if(args.containsKey("index")){ throw new IllegalArgumentException("The 'index' parameter cannot be passed to an index's oneshot upload."); } args.add("index", getName()); uploads.create(filename, args); } }