/// <summary> /// Establishes a connection to a Splunk service using a map of /// arguments. /// </summary> /// <param name="args">The connection arguments.</param> /// <returns>A new <see cref="Service"/> instance.</returns> /// <remarks> /// This method creates a new <see cref="Service"/> instance and /// authenticates the session using credentials passed in from the args /// dictionary. /// </remarks> public static Service Connect(Dictionary <string, object> args) { Service service = new Service(args); if (args.ContainsKey("username")) { string username = Args.Get(args, "username", null); string password = Args.Get(args, "password", null); service.Login(username, password); } return(service); }
/// <summary> /// Initializes a new instance of the <see cref="Service"/> class /// with a general argument list. /// </summary> /// <param name="args">The service arguments.</param> public Service(Dictionary <string, object> args) : base() { this.InitProperties(); this.App = Args.Get(args, "app", null); this.Host = Args.Get(args, "host", defaultHost); this.Owner = Args.Get(args, "owner", null); this.Port = args.ContainsKey("port") ? Convert.ToInt32(args["port"]) : defaultPort; this.Scheme = Args.Get(args, "scheme", HttpService.DefaultScheme); this.Token = Args.Get(args, "token", null); }