コード例 #1
0
        /// <summary>
        /// Update the specified service properties according to the input in old XSCL
        /// </summary>
        /// <param name="serviceProperties">Service properties</param>
        internal void UpdateServiceProperties(XTable.MetricsProperties metrics)
        {
            if (Version != null)
            {
                metrics.Version = Version.ToString();
            }

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

            if (MetricsLevel != null)
            {
                MetricsLevel metricsLevel = MetricsLevel.Value;
                metrics.MetricsLevel = (XTable.MetricsLevel)Enum.Parse(typeof(XTable.MetricsLevel), metricsLevel.ToString(), true);
                // Set default metrics version
                if (string.IsNullOrEmpty(metrics.Version))
                {
                    string defaultMetricsVersion = StorageNouns.DefaultMetricsVersion;
                    metrics.Version = defaultMetricsVersion;
                }
            }
        }
コード例 #2
0
 public ServiceProperties(LoggingProperties logging = null, MetricsProperties hourMetrics = null, MetricsProperties minuteMetrics = null, CorsProperties cors = null)
 {
     Logging       = logging;
     HourMetrics   = hourMetrics;
     MinuteMetrics = minuteMetrics;
     Cors          = cors;
 }