示例#1
0
        /// <inheritdoc/>
        protected override void CreateSnapshot(AtomFeed feed)
        {
            var snapshot = new Resource();

            BaseResource.Initialize <Resource, ConfigurationSetting>(snapshot, feed);
            this.Snapshot = (Resource)snapshot;
        }
        /// <inheritdoc/>
        public virtual async Task <ApplicationArchiveInfo> PackageAsync()
        {
            var resourceName = new ResourceName(this.ResourceName, "package");

            using (var response = await this.Context.GetAsync(this.Namespace, resourceName).ConfigureAwait(false))
            {
                await response.EnsureStatusCodeAsync(HttpStatusCode.OK).ConfigureAwait(false);

                var resource = await BaseResource.CreateAsync <ApplicationArchiveInfo>(response).ConfigureAwait(false);

                return(resource);
            }
        }
示例#3
0
        /// <summary>
        /// Determines whether the specified resource refers to the same
        /// resource as the current one.
        /// </summary>
        /// <param name="other">
        /// The <see cref="BaseResource"/> to compare with the current one.
        /// </param>
        /// <returns>
        /// A value of <c>true</c> if the two instances represent the same
        /// resource; otherwise, <c>false</c>.
        /// </returns>
        public bool Equals(BaseResource other)
        {
            if ((object)other == null)
            {
                return(false);
            }

            if (object.ReferenceEquals(this, other))
            {
                return(true);
            }

            bool result = this.Id.Equals(other.Id);

            return(result);
        }
示例#4
0
 /// <inheritdoc/>
 protected internal override void Initialize(AtomEntry entry, Version generatorVersion)
 {
     BaseResource.Initialize(this, entry, generatorVersion);
 }
 /// <summary>
 /// Infrastructure. Initializes a new instance of the
 /// <see cref= "ConfigurationSetting"/> class.
 /// </summary>
 /// <param name="resource">
 /// An object representing a configuration setting.
 /// </param>
 internal ConfigurationSetting(BaseResource resource)
 {
     this.Object = resource.Object;
 }
示例#6
0
 /// <summary>
 /// Infrastructure. Initializes the current uninitialized
 /// <see cref= "ResourceCollection"/>.
 /// </summary>
 /// <remarks>
 /// This method may be called once to initialize a
 /// <see cref="ResourceCollection"/>
 /// instantiated by the default constructor. Override this method to provide
 /// special initialization code. Call this base method before initialization
 /// is complete.
 /// <note type="note">
 /// This method supports the Splunk client infrastructure and is not intended
 /// to be used directly from your code.
 /// </note>
 /// </remarks>
 /// <typeparam name="TResource">
 /// Type of the resource.
 /// </typeparam>
 /// <param name="feed">
 /// An object representing a Splunk atom feed response.
 /// </param>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="feed"/> is <c>null</c>.
 /// </exception>
 /// <exception cref="InvalidOperationException">
 /// The current <see cref="ResourceCollection"/> is already initialized.
 /// </exception>
 protected internal virtual void Initialize <TResource>(AtomFeed feed) where TResource : BaseResource, new()
 {
     BaseResource.Initialize <ResourceCollection, TResource>(this, feed);
 }
示例#7
0
 /// <summary>
 /// Infrastructure. Initializes the current uninitialized
 /// <see cref= "ResourceCollection"/>.
 /// </summary>
 /// <remarks>
 /// This method may be called once to initialize a
 /// <see cref="ResourceCollection"/>
 /// instantiated by the default constructor. Override this method to provide
 /// special initialization code. Call this base method before initialization
 /// is complete.
 /// <note type="note">
 /// This method supports the Splunk client infrastructure and is not intended
 /// to be used directly from your code.
 /// </note>
 /// </remarks>
 /// <param name="feed">
 /// An object representing a Splunk atom feed response.
 /// </param>
 /// <seealso cref="M:Splunk.Client.BaseResource.Initialize(AtomFeed)"/>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="feed"/> is <c>null</c>.
 /// </exception>
 /// <exception cref="InvalidOperationException">
 /// The current <see cref="ResourceCollection"/> is already initialized.
 /// </exception>
 protected internal override void Initialize(AtomFeed feed)
 {
     BaseResource.Initialize <ResourceCollection, Resource>(this, feed);
 }