internal static MetricNamespace DeserializeMetricNamespace(JsonElement element) { Optional <NamespaceClassification> classification = default; Optional <MetricNamespaceName> properties = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("classification")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } classification = new NamespaceClassification(property.Value.GetString()); continue; } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } properties = MetricNamespaceName.DeserializeMetricNamespaceName(property.Value); continue; } if (property.NameEquals("id")) { id = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("type")) { type = property.Value.GetString(); continue; } if (property.NameEquals("systemData")) { systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString()); continue; } } return(new MetricNamespace(id, name, type, systemData, Optional.ToNullable(classification), properties.Value)); }
internal MetricNamespace(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, NamespaceClassification?classification, MetricNamespaceName properties) : base(id, name, resourceType, systemData) { Classification = classification; Properties = properties; }