/* * Copyright 2012 Splunk, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"): you may * not use this file except in compliance with the License. You may obtain * a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ namespace Splunk { using System; /// /// Represents the Collection of SavedSearches /// public class SavedSearchCollection : EntityCollection { /// /// Initializes a new instance of the /// class. /// /// The connected service public SavedSearchCollection(Service service) : base(service, "saved/searches", typeof(SavedSearch)) { } /// /// Initializes a new instance of the /// class. /// /// The connected service /// The arguments public SavedSearchCollection(Service service, Args args) : base(service, "saved/searches", args, typeof(SavedSearch)) { } /// /// Creates a saved search without a search string -- is unsupported /// /// Search name /// NA: throws an exception public override SavedSearch Create(string name) { throw new Exception("Create unsuported"); } /// /// Creates a saved search from a name and search expression. /// /// The name of the search /// The search string /// The saved search public SavedSearch Create(string name, string search) { Args args = new Args("search", search); return base.Create(name, args); } /// /// Creates a saved search from a name, search expression, and /// additional arguments. /// /// /// The name of the saved search /// The searchstring /// The arguments /// The saved search public SavedSearch Create(string name, string search, Args args) { args = Args.Create(args); args.Add("search", search); return base.Create(name, args); } } }