internal static ScaleRuleMetricDimension DeserializeScaleRuleMetricDimension(JsonElement element)
        {
            string dimensionName = default;
            ScaleRuleMetricDimensionOperationType @operator = default;
            IList <string> values = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("DimensionName"))
                {
                    dimensionName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("Operator"))
                {
                    @operator = new ScaleRuleMetricDimensionOperationType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("Values"))
                {
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetString());
                    }
                    values = array;
                    continue;
                }
            }
            return(new ScaleRuleMetricDimension(dimensionName, @operator, values));
        }
Ejemplo n.º 2
0
        public ScaleRuleMetricDimension(string dimensionName, ScaleRuleMetricDimensionOperationType @operator, IEnumerable <string> values)
        {
            if (dimensionName == null)
            {
                throw new ArgumentNullException(nameof(dimensionName));
            }
            if (values == null)
            {
                throw new ArgumentNullException(nameof(values));
            }

            DimensionName = dimensionName;
            Operator      = @operator;
            Values        = values.ToList();
        }
Ejemplo n.º 3
0
 internal ScaleRuleMetricDimension(string dimensionName, ScaleRuleMetricDimensionOperationType @operator, IList <string> values)
 {
     DimensionName = dimensionName;
     Operator      = @operator;
     Values        = values;
 }