Beispiel #1
0
 /// <summary>
 /// Initializes a new instance of the ServiceProperties class.
 /// </summary>
 public ServiceProperties(LoggingProperties logging = null, MetricsProperties hourMetrics = null, MetricsProperties minuteMetrics = null, CorsProperties cors = null)
 {
     this.Logging       = logging;
     this.HourMetrics   = hourMetrics;
     this.MinuteMetrics = minuteMetrics;
     this.Cors          = cors;
 }
 /// <summary>
 /// Initializes a new instance of the ServiceProperties class.
 /// </summary>
 public ServiceProperties(LoggingProperties logging = null, MetricsProperties hourMetrics = null, MetricsProperties minuteMetrics = null, CorsProperties cors = null, DeleteRetentionPolicy deleteRetentionPolicy = null)
 {
     this.Logging               = logging;
     this.HourMetrics           = hourMetrics;
     this.MinuteMetrics         = minuteMetrics;
     this.Cors                  = cors;
     this.DeleteRetentionPolicy = deleteRetentionPolicy;
 }
 /// <summary>
 /// Initializes a new instance of the ServiceProperties class.
 /// </summary>
 public ServiceProperties(LoggingProperties logging, MetricsProperties hourMetrics, MetricsProperties minuteMetrics, CorsProperties cors, DeleteRetentionPolicy deleteRetentionPolicy, StaticWebsiteProperties staticWebsite = null)
 {
     this.Logging               = logging;
     this.HourMetrics           = hourMetrics;
     this.MinuteMetrics         = minuteMetrics;
     this.Cors                  = cors;
     this.DeleteRetentionPolicy = deleteRetentionPolicy;
     this.StaticWebsite         = staticWebsite;
 }
        /// <summary>
        /// Update the specified service properties according to the input
        /// </summary>
        /// <param name="logging">Service properties</param>
        internal void UpdateServiceProperties(LoggingProperties logging)
        {
            if (Version != null)
            {
                logging.Version = Version.ToString();
            }

            if (RetentionDays != null)
            {
                if (RetentionDays == -1)
                {
                    //Disable logging retention policy
                    logging.RetentionDays = null;
                }
                else if (RetentionDays < 1 || RetentionDays > 365)
                {
                    throw new ArgumentException(string.Format(Resources.InvalidRetentionDay, RetentionDays));
                }
                else
                {
                    logging.RetentionDays = RetentionDays;
                }
            }

            if (LoggingOperations != null && LoggingOperations.Length > 0)
            {
                LoggingOperations logOperations = default(LoggingOperations);

                for (int i = 0; i < LoggingOperations.Length; i++)
                {
                    if (LoggingOperations[i] == StorageClient.LoggingOperations.None
                        || LoggingOperations[i] == StorageClient.LoggingOperations.All)
                    {
                        if (LoggingOperations.Length > 1)
                        {
                            throw new ArgumentException(Resources.NoneAndAllOperationShouldBeAlone);
                        }
                    }

                    logOperations |= LoggingOperations[i];
                }

                logging.LoggingOperations = logOperations;
                // Set default logging version
                if (string.IsNullOrEmpty(logging.Version))
                {
                    string defaultLoggingVersion = StorageNouns.DefaultLoggingVersion;
                    logging.Version = defaultLoggingVersion;
                }
            }
        }
Beispiel #5
0
        /// <summary>
        /// Generates XML representing the given logging properties.
        /// </summary>
        /// <param name="logging">The logging properties.</param>
        /// <returns>An XML logging element.</returns>
        private static XElement GenerateLoggingXml(LoggingProperties logging)
        {
            if ((LoggingOperations.All & logging.LoggingOperations) != logging.LoggingOperations)
            {
                throw new InvalidOperationException(SR.InvalidLoggingLevel);
            }

            if (string.IsNullOrEmpty(logging.Version))
            {
                throw new InvalidOperationException(SR.LoggingVersionNull);
            }

            return(new XElement(
                       LoggingName,
                       new XElement(VersionName, logging.Version),
                       new XElement(DeleteName, (logging.LoggingOperations & LoggingOperations.Delete) != 0),
                       new XElement(ReadName, (logging.LoggingOperations & LoggingOperations.Read) != 0),
                       new XElement(WriteName, (logging.LoggingOperations & LoggingOperations.Write) != 0),
                       GenerateRetentionPolicyXml(logging.RetentionDays)));
        }
        /// <summary>
        /// Generates XML representing the given logging properties.
        /// </summary>
        /// <param name="logging">The logging properties.</param>
        /// <returns>An XML logging element.</returns>
        private static XElement GenerateLoggingXml(LoggingProperties logging)
        {
            if ((LoggingOperations.All & logging.LoggingOperations) != logging.LoggingOperations)
            {
                throw new InvalidOperationException(SR.InvalidLoggingLevel);
            }

            if (string.IsNullOrEmpty(logging.Version))
            {
                throw new InvalidOperationException(SR.LoggingVersionNull);
            }

            return new XElement(
                LoggingName,
                new XElement(VersionName, logging.Version),
                new XElement(DeleteName, (logging.LoggingOperations & LoggingOperations.Delete) != 0),
                new XElement(ReadName, (logging.LoggingOperations & LoggingOperations.Read) != 0),
                new XElement(WriteName, (logging.LoggingOperations & LoggingOperations.Write) != 0),
                GenerateRetentionPolicyXml(logging.RetentionDays));
        }
 /// <summary>
 /// Initializes a new instance of the ServiceProperties class.
 /// </summary>
 public ServiceProperties(LoggingProperties logging = null, MetricsProperties hourMetrics = null, MetricsProperties minuteMetrics = null, CorsProperties cors = null)
 {
     this.Logging = logging;
     this.HourMetrics = hourMetrics;
     this.MinuteMetrics = minuteMetrics;
     this.Cors = cors;
 }
        private static LoggingProperties Clone(LoggingProperties logging)
        {
            if (logging == null)
            {
                return null;
            }

            return new LoggingProperties
            {
                LoggingOperations = logging.LoggingOperations,
                RetentionDays = logging.RetentionDays,
                Version = logging.Version
            };
        }
 private static XElement GenerateLoggingXml(LoggingProperties logging)
 {
     throw new System.NotImplementedException();
 }
 public ServiceProperties(LoggingProperties logging = null, MetricsProperties hourMetrics = null, MetricsProperties minuteMetrics = null, CorsProperties cors = null)
 {
     throw new System.NotImplementedException();
 }
 /// <summary>
 /// Initializes a new instance of the ServiceProperties class.
 /// </summary>
 public ServiceProperties(LoggingProperties logging = null, MetricsProperties hourMetrics = null, MetricsProperties minuteMetrics = null, CorsProperties cors = null, DeleteRetentionPolicy deleteRetentionPolicy = null)
     : this(logging, hourMetrics, minuteMetrics, cors, deleteRetentionPolicy, staticWebsite : null)
 {
 }