コード例 #1
0
 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);
 }
コード例 #2
0
 internal BlobInventoryPolicySchema(bool enabled, string destination, InventoryRuleType inventoryRuleType, IList <BlobInventoryPolicyRule> rules)
 {
     Enabled           = enabled;
     Destination       = destination;
     InventoryRuleType = inventoryRuleType;
     Rules             = rules;
 }
コード例 #3
0
        public BlobInventoryPolicySchema(bool enabled, InventoryRuleType inventoryRuleType, IEnumerable <BlobInventoryPolicyRule> rules)
        {
            if (rules == null)
            {
                throw new ArgumentNullException(nameof(rules));
            }

            Enabled           = enabled;
            InventoryRuleType = inventoryRuleType;
            Rules             = rules.ToList();
        }
コード例 #4
0
 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();
 }
コード例 #5
0
 internal BlobInventoryPolicySchema(bool enabled, InventoryRuleType inventoryRuleType, IList <BlobInventoryPolicyRule> rules)
 {
     Enabled           = enabled;
     InventoryRuleType = inventoryRuleType;
     Rules             = rules;
 }