internal static BlobInventoryPolicySchema DeserializeBlobInventoryPolicySchema(JsonElement element) { bool enabled = default; InventoryRuleType type = default; IList<BlobInventoryPolicyRule> rules = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("enabled")) { enabled = property.Value.GetBoolean(); continue; } if (property.NameEquals("type")) { type = new InventoryRuleType(property.Value.GetString()); continue; } if (property.NameEquals("rules")) { List<BlobInventoryPolicyRule> array = new List<BlobInventoryPolicyRule>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(BlobInventoryPolicyRule.DeserializeBlobInventoryPolicyRule(item)); } rules = array; continue; } } return new BlobInventoryPolicySchema(enabled, type, rules); }
internal BlobInventoryPolicySchema(bool enabled, string destination, InventoryRuleType inventoryRuleType, IList <BlobInventoryPolicyRule> rules) { Enabled = enabled; Destination = destination; InventoryRuleType = inventoryRuleType; Rules = rules; }
public BlobInventoryPolicySchema(bool enabled, InventoryRuleType inventoryRuleType, IEnumerable <BlobInventoryPolicyRule> rules) { if (rules == null) { throw new ArgumentNullException(nameof(rules)); } Enabled = enabled; InventoryRuleType = inventoryRuleType; Rules = rules.ToList(); }
void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); writer.WritePropertyName("enabled"); writer.WriteBooleanValue(Enabled); writer.WritePropertyName("type"); writer.WriteStringValue(InventoryRuleType.ToString()); writer.WritePropertyName("rules"); writer.WriteStartArray(); foreach (var item in Rules) { writer.WriteObjectValue(item); } writer.WriteEndArray(); writer.WriteEndObject(); }
internal BlobInventoryPolicySchema(bool enabled, InventoryRuleType inventoryRuleType, IList <BlobInventoryPolicyRule> rules) { Enabled = enabled; InventoryRuleType = inventoryRuleType; Rules = rules; }