示例#1
0
 /// <summary>
 /// Asynchronously updates the attributes of the application represented
 /// by the current instance.
 /// </summary>
 /// <param name="attributes">
 /// New attributes for the current <see cref="Application"/> instance.
 /// </param>
 /// <param name="checkForUpdates">
 /// A value of <c>true</c>, if Splunk should check Splunkbase for
 /// updates to the current <see cref="Application"/> instance.
 /// </param>
 /// <remarks>
 /// This method uses the <a href="http://goo.gl/dKraaR">POST
 /// apps/local/{name}</a> endpoint to update the attributes of the
 /// current <see cref="Application"/> and optionally check for
 /// updates on Splunkbase.
 /// </remarks>
 public async Task UpdateAsync(ApplicationAttributes attributes, bool checkForUpdates = false)
 {
     using (var response = await this.Context.PostAsync(this.Namespace, this.ResourceName, attributes))
     {
         await response.EnsureStatusCodeAsync(HttpStatusCode.OK);
     }
 }
        /// <inheritdoc/>
        public virtual async Task <bool> UpdateAsync(ApplicationAttributes attributes, bool checkForUpdates = false)
        {
            var updateArgs = new UpdateArgs {
                CheckForUpdates = checkForUpdates
            };

            return(await this.UpdateAsync(updateArgs.AsEnumerable().Concat(attributes)).ConfigureAwait(false));
        }
示例#3
0
        /// <summary>
        /// Asynchronously creates the current <see cref="Application"/>.
        /// instance.
        /// </summary>
        /// <remarks>
        /// This method uses the <a href="http://goo.gl/SzKzNX">POST
        /// apps/local</a> endpoint to create the current <see cref=
        /// "Application"/>.
        /// </remarks>
        public async Task CreateAsync(string template, ApplicationAttributes attributes = null)
        {
            var resourceName = ApplicationCollection.ClassResourceName;

            var args = new CreationArgs()
            {
                ExplicitApplicationName = this.Name,
                Filename = false,
                Name     = this.Name,
                Template = template
            };

            using (var response = await this.Context.PostAsync(this.Namespace, resourceName, args, attributes))
            {
                await response.EnsureStatusCodeAsync(HttpStatusCode.Created);

                await this.UpdateSnapshotAsync(response);
            }
        }
        /// <inheritdoc/>
        public async Task <Application> CreateAsync(string name, string template, ApplicationAttributes attributes = null)
        {
            var arguments = new CreationArgs
            {
                ExplicitApplicationName = name,
                Filename = false,
                Name     = name,
                Template = template
            }
            .AsEnumerable();

            if (attributes != null)
            {
                arguments = arguments.Concat(attributes);
            }

            var resourceEndpoint = await this.CreateAsync(arguments).ConfigureAwait(false);

            return(resourceEndpoint);
        }
 public Task <TApplication> CreateAsync(string name, string template, ApplicationAttributes attributes)
 {
     Contract.Requires <ArgumentNullException>(template != null);
     Contract.Requires <ArgumentNullException>(name != null);
     return(default(Task <TApplication>));
 }
示例#6
0
 /// <summary>
 /// Asynchronously updates the attributes of the application represented by
 /// the current instance.
 /// </summary>
 /// <param name="attributes">
 /// New attributes for the current <see cref="Application"/> instance.
 /// </param>
 /// <param name="checkForUpdates">
 /// A value of <c>true</c>, if Splunk should check Splunkbase for updates to
 /// the current <see cref="Application"/> instance.
 /// </param>
 /// <returns>
 /// <c>true</c> if the current snapshot was also updated.
 /// </returns>
 /// <seealso cref="M:Splunk.Client.IApplication.UpdateAsync(ApplicationAttributes,bool)"/>
 public Task <bool> UpdateAsync(ApplicationAttributes attributes, bool checkForUpdates)
 {
     Contract.Requires <ArgumentNullException>(attributes != null);
     return(default(Task <bool>));
 }