/// <summary> /// Initializes a new instance of the <see cref="Resource"/> class, /// adding optional arguments for namespace and other endpoint /// arguments. /// </summary> /// <param name="service">The service.</param> /// <param name="path">The path of this resource.</param> /// <param name="args">The variable arguments.</param> public Resource(Service service, string path, Args args) { this.Service = service; /* Pull out namespace items (app, owner, sharing) from the args, and * then use to create the full path. */ Args clonedArgs = new Args(args); Args splunkNamespace = new Args(); if (args.ContainsKey("app")) { splunkNamespace.Set("app", args["app"].ToString()); clonedArgs.Remove("app"); } if (args.ContainsKey("owner")) { splunkNamespace.Set("owner", args["owner"].ToString()); clonedArgs.Remove("owner"); } if (args.ContainsKey("sharing")) { splunkNamespace.Set( "sharing", args["sharing"].ToString()); clonedArgs.Remove("sharing"); } if (!clonedArgs.ContainsKey("count")) { clonedArgs.Set("count", "-1"); } this.RefreshArgs = clonedArgs; this.Path = service.Fullpath( path, splunkNamespace.Count == 0 ? null : splunkNamespace); this.MaybeValid = false; }