コード例 #1
0
        internal static MetricAlertCriteria DeserializeMetricAlertCriteria(JsonElement element)
        {
            if (element.TryGetProperty("odata.type", out JsonElement discriminator))
            {
                switch (discriminator.GetString())
                {
                case "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria": return(MetricAlertMultipleResourceMultipleMetricCriteria.DeserializeMetricAlertMultipleResourceMultipleMetricCriteria(element));

                case "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria": return(MetricAlertSingleResourceMultipleMetricCriteria.DeserializeMetricAlertSingleResourceMultipleMetricCriteria(element));

                case "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria": return(WebtestLocationAvailabilityCriteria.DeserializeWebtestLocationAvailabilityCriteria(element));
                }
            }
            Odatatype odataType = default;
            IDictionary <string, object> additionalProperties           = default;
            Dictionary <string, object>  additionalPropertiesDictionary = new Dictionary <string, object>();

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("odata.type"))
                {
                    odataType = new Odatatype(property.Value.GetString());
                    continue;
                }
                additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject());
            }
            additionalProperties = additionalPropertiesDictionary;
            return(new MetricAlertCriteria(odataType, additionalProperties));
        }
コード例 #2
0
        internal static MetricAlertMultipleResourceMultipleMetricCriteria DeserializeMetricAlertMultipleResourceMultipleMetricCriteria(JsonElement element)
        {
            Optional <IList <MultiMetricCriteria> > allOf = default;
            Odatatype odataType = default;
            IDictionary <string, object> additionalProperties           = default;
            Dictionary <string, object>  additionalPropertiesDictionary = new Dictionary <string, object>();

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("allOf"))
                {
                    List <MultiMetricCriteria> array = new List <MultiMetricCriteria>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(MultiMetricCriteria.DeserializeMultiMetricCriteria(item));
                    }
                    allOf = array;
                    continue;
                }
                if (property.NameEquals("odata.type"))
                {
                    odataType = new Odatatype(property.Value.GetString());
                    continue;
                }
                additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject());
            }
            additionalProperties = additionalPropertiesDictionary;
            return(new MetricAlertMultipleResourceMultipleMetricCriteria(odataType, additionalProperties, Optional.ToList(allOf)));
        }
コード例 #3
0
 internal WebtestLocationAvailabilityCriteria(Odatatype odataType, IDictionary <string, object> additionalProperties, string webTestId, string componentId, float failedLocationCount) : base(odataType, additionalProperties)
 {
     WebTestId           = webTestId;
     ComponentId         = componentId;
     FailedLocationCount = failedLocationCount;
     OdataType           = odataType;
 }
コード例 #4
0
        internal static WebtestLocationAvailabilityCriteria DeserializeWebtestLocationAvailabilityCriteria(JsonElement element)
        {
            string    webTestId           = default;
            string    componentId         = default;
            float     failedLocationCount = default;
            Odatatype odataType           = default;
            IDictionary <string, object> additionalProperties           = default;
            Dictionary <string, object>  additionalPropertiesDictionary = new Dictionary <string, object>();

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("webTestId"))
                {
                    webTestId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("componentId"))
                {
                    componentId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("failedLocationCount"))
                {
                    failedLocationCount = property.Value.GetSingle();
                    continue;
                }
                if (property.NameEquals("odata.type"))
                {
                    odataType = new Odatatype(property.Value.GetString());
                    continue;
                }
                additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject());
            }
            additionalProperties = additionalPropertiesDictionary;
            return(new WebtestLocationAvailabilityCriteria(odataType, additionalProperties, webTestId, componentId, failedLocationCount));
        }
コード例 #5
0
 internal MetricAlertCriteria(Odatatype odataType, IDictionary <string, object> additionalProperties)
 {
     OdataType            = odataType;
     AdditionalProperties = additionalProperties;
 }
コード例 #6
0
 public MetricAlertCriteria()
 {
     AdditionalProperties = new ChangeTrackingDictionary <string, object>();
     OdataType            = new Odatatype("MetricAlertCriteria");
 }
コード例 #7
0
 internal MetricAlertMultipleResourceMultipleMetricCriteria(Odatatype odataType, IDictionary <string, object> additionalProperties, IList <MultiMetricCriteria> allOf) : base(odataType, additionalProperties)
 {
     AllOf     = allOf;
     OdataType = odataType;
 }