예제 #1
0
        internal static BlobInventoryPolicyRule DeserializeBlobInventoryPolicyRule(JsonElement element)
        {
            bool   enabled     = default;
            string name        = default;
            string destination = default;
            BlobInventoryPolicyDefinition definition = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("enabled"))
                {
                    enabled = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("destination"))
                {
                    destination = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("definition"))
                {
                    definition = BlobInventoryPolicyDefinition.DeserializeBlobInventoryPolicyDefinition(property.Value);
                    continue;
                }
            }
            return(new BlobInventoryPolicyRule(enabled, name, destination, definition));
        }
예제 #2
0
        public BlobInventoryPolicyRule(bool enabled, string name, string destination, BlobInventoryPolicyDefinition definition)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }
            if (destination == null)
            {
                throw new ArgumentNullException(nameof(destination));
            }
            if (definition == null)
            {
                throw new ArgumentNullException(nameof(definition));
            }

            Enabled     = enabled;
            Name        = name;
            Destination = destination;
            Definition  = definition;
        }