/// <summary>
 /// Initializes a new <see cref="EntityCollection&lt;TEntity,TResource&gt;"/> instance.
 /// </summary>
 /// <param name="service">
 /// An object representing a root Splunk service endpoint.
 /// </param>
 /// <param name="name">
 /// An object identifying a Splunk resource within
 /// <paramref name= "service"/>.<see cref="Namespace"/>.
 /// </param>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="service"/> or <paramref name="name"/> are <c>null</c>.
 /// </exception>
 protected internal EntityCollection(Service service, ResourceName name)
     : base(service, name)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="EntityCollection&lt;TEntity,TResource&gt;"/> class.
 /// </summary>
 /// <param name="context">
 /// An object representing a Splunk server session.
 /// </param>
 /// <param name="ns">
 /// An object identifying a Splunk services namespace.
 /// </param>
 /// <param name="name">
 /// An object identifying a Splunk entity collection within
 /// <paramref name="ns"/>.
 /// </param>
 protected internal EntityCollection(Context context, Namespace ns, ResourceName name)
     : base(context, ns, name)
 {
 }
예제 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Entity&lt;TResource&gt;"/> class.
 /// </summary>
 /// <param name="context">
 /// An object representing a Splunk server session.
 /// </param>
 /// <param name="ns">
 /// An object identifying a Splunk services namespace.
 /// </param>
 /// <param name="collection">
 /// The <see cref="ResourceName"/> of an <see cref="EntityCollection&lt;TEntity,TResource&gt;"/>.
 /// </param>
 /// <param name="name">
 /// The name of an entity within <paramref name="collection"/>.
 /// </param>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="context"/>, <paramref name="ns"/>, or <paramref
 /// name="collection"/>, or <paramref name="name"/> are <c>null</c>.
 /// </exception>
 /// <exception cref="ArgumentOutOfRangeException">
 /// <paramref name="ns"/> is not specific.
 /// </exception>
 protected internal Entity(Context context, Namespace ns, ResourceName collection, string name)
     : this(context, ns, new ResourceName(collection, name))
 {
 }
예제 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Entity&lt;TResource&gt;"/> class.
 /// </summary>
 /// <param name="service">
 /// An object representing a root Splunk service endpoint.
 /// </param>
 /// <param name="name">
 /// An object identifying a Splunk resource within
 /// <paramref name= "service"/>.<see cref="Namespace"/>.
 /// </param>
 ///
 /// ### <exception cref="ArgumentNullException">
 /// <paramref name="service"/> or <paramref name="name"/> are <c>null</c>.
 /// </exception>
 protected internal Entity(Service service, ResourceName name)
     : base(service.Context, service.Namespace, name)
 {
     Contract.Requires <ArgumentNullException>(service != null);
 }
예제 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Entity&lt;TResource&gt;"/>
 /// class.
 /// </summary>
 /// <param name="context">
 /// An object representing a Splunk server session.
 /// </param>
 /// <param name="ns">
 /// An object identifying a Splunk services namespace.
 /// </param>
 /// <param name="resourceName">
 /// An object identifying a Splunk resource within <paramref name="ns"/>.
 /// </param>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="context"/>, <paramref name="ns"/>, or
 /// <paramref name= "resourceName"/> are <c>null</c>.
 /// </exception>
 /// <exception cref="ArgumentOutOfRangeException">
 /// <paramref name="ns"/> is not specific.
 /// </exception>
 protected internal Entity(Context context, Namespace ns, ResourceName resourceName)
     : base(context, ns, resourceName)
 {
 }
예제 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Endpoint"/> class.
 /// </summary>
 /// <param name="context">
 /// An object representing a Splunk server session.
 /// </param>
 /// <param name="ns">
 /// An object identifying a Splunk services namespace.
 /// </param>
 /// <param name="name">
 /// An object identifying a Splunk resource within <paramref name="ns"/>.
 /// </param>
 ///
 /// ### <exception cref="ArgumentNullException">
 /// <paramref name="context"/>, <paramref name="ns"/>, or
 /// <paramref name= "name"/> are <c>null</c>.
 /// </exception>
 /// ### <exception cref="ArgumentOutOfRangeException">
 /// <paramref name="ns"/> is not specific.
 /// </exception>
 public Endpoint(Context context, Namespace ns, ResourceName name)
 {
     this.Initialize(context, ns, name);
 }
예제 #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Endpoint"/> class.
 /// </summary>
 /// <param name="service">
 /// An object representing a root Splunk service endpoint.
 /// </param>
 /// <param name="name">
 /// An object identifying a Splunk resource within
 /// <paramref name= "service"/>.<see cref="Namespace"/>.
 /// </param>
 ///
 /// ### <exception cref="ArgumentNullException">
 /// <paramref name="service"/> or <paramref name="name"/> are <c>null</c>.
 /// </exception>
 public Endpoint(Service service, ResourceName name)
     : this(service.Context, service.Namespace, name)
 {
     Contract.Requires <ArgumentNullException>(service != null);
 }
예제 #8
0
        /// <summary>
        /// Sends a GET, POST, or DELETE request as an asynchronous operation.
        /// </summary>
        /// <param name="method">
        ///
        /// </param>
        /// <param name="ns">
        /// An object identifying a Splunk services namespace.
        /// </param>
        /// <param name="resource">
        ///
        /// </param>
        /// <param name="argumentSets">
        ///
        /// </param>
        /// <returns>
        /// The response to the GET, POST, or DELETE request.
        /// </returns>
        public virtual async Task <Response> SendAsync(HttpMethod method, Namespace ns, ResourceName resource,
                                                       params IEnumerable <Argument>[] argumentSets)
        {
            Contract.Requires <ArgumentNullException>(method != null);
            Contract.Requires <ArgumentException>(method == HttpMethod.Delete || method == HttpMethod.Get || method == HttpMethod.Post);
            var         token   = CancellationToken.None;
            HttpContent content = null;

            if (method == HttpMethod.Post)
            {
                content      = CreateStringContent(argumentSets);
                argumentSets = null;
            }

            var response = await this.GetResponseAsync(method, ns, resource, content, token, argumentSets).ConfigureAwait(false);

            return(response);
        }
예제 #9
0
        /// <summary>
        /// Sends a GET request as an asynchronous operation.
        /// </summary>
        /// <param name="ns">
        /// An object identifying a Splunk services namespace.
        /// </param>
        /// <param name="resource">
        /// An object identifiying a Splunk resource in the context of <paramref name="ns"/>.
        /// </param>
        /// <param name="token">
        ///
        /// </param>
        /// <param name="argumentSets">
        ///
        /// </param>
        /// <returns>
        /// The response to the GET request.
        /// </returns>
        public virtual async Task <HttpResponseMessage> GetHttpResponseMessageAsync(Namespace ns, ResourceName resource,
                                                                                    CancellationToken token, params IEnumerable <Argument>[] argumentSets)
        {
            var message = await this.SendAsync(HttpMethod.Get, ns, resource, null, token, argumentSets).ConfigureAwait(false);

            return(message);
        }