void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); writer.WritePropertyName("criterionType"); writer.WriteStringValue(CriterionType.ToString()); writer.WritePropertyName("name"); writer.WriteStringValue(Name); writer.WritePropertyName("metricName"); writer.WriteStringValue(MetricName); if (Optional.IsDefined(MetricNamespace)) { writer.WritePropertyName("metricNamespace"); writer.WriteStringValue(MetricNamespace); } writer.WritePropertyName("timeAggregation"); writer.WriteStringValue(TimeAggregation.ToSerialString()); if (Optional.IsCollectionDefined(Dimensions)) { writer.WritePropertyName("dimensions"); writer.WriteStartArray(); foreach (var item in Dimensions) { writer.WriteObjectValue(item); } writer.WriteEndArray(); } foreach (var item in AdditionalProperties) { writer.WritePropertyName(item.Key); writer.WriteObjectValue(item.Value); } writer.WriteEndObject(); }
void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); writer.WritePropertyName("operator"); writer.WriteStringValue(Operator.ToString()); writer.WritePropertyName("alertSensitivity"); writer.WriteStringValue(AlertSensitivity.ToString()); writer.WritePropertyName("failingPeriods"); writer.WriteObjectValue(FailingPeriods); if (Optional.IsDefined(IgnoreDataBefore)) { writer.WritePropertyName("ignoreDataBefore"); writer.WriteStringValue(IgnoreDataBefore.Value, "O"); } writer.WritePropertyName("criterionType"); writer.WriteStringValue(CriterionType.ToString()); writer.WritePropertyName("name"); writer.WriteStringValue(Name); writer.WritePropertyName("metricName"); writer.WriteStringValue(MetricName); if (Optional.IsDefined(MetricNamespace)) { writer.WritePropertyName("metricNamespace"); writer.WriteStringValue(MetricNamespace); } writer.WritePropertyName("timeAggregation"); writer.WriteStringValue(TimeAggregation.ToSerialString()); if (Optional.IsCollectionDefined(Dimensions)) { writer.WritePropertyName("dimensions"); writer.WriteStartArray(); foreach (var item in Dimensions) { writer.WriteObjectValue(item); } writer.WriteEndArray(); } foreach (var item in AdditionalProperties) { writer.WritePropertyName(item.Key); writer.WriteObjectValue(item.Value); } writer.WriteEndObject(); }