< Summary

Class:Azure.ResourceManager.Storage.Models.ManagementPolicyFilter
Assembly:Azure.ResourceManager.Storage
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\ManagementPolicyFilter.cs
C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\ManagementPolicyFilter.Serialization.cs
Covered lines:47
Uncovered lines:16
Coverable lines:63
Total lines:166
Line coverage:74.6% (47 of 63)
Covered branches:24
Total branches:38
Branch coverage:63.1% (24 of 38)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-80%50%
.ctor(...)-100%50%
get_PrefixMatch()-100%100%
get_BlobTypes()-100%100%
get_BlobIndexMatch()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-75%70%
DeserializeManagementPolicyFilter(...)-66.67%62.5%

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\ManagementPolicyFilter.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System;
 9using System.Collections.Generic;
 10using System.Linq;
 11
 12namespace Azure.ResourceManager.Storage.Models
 13{
 14    /// <summary> Filters limit rule actions to a subset of blobs within the storage account. If multiple filters are de
 15    public partial class ManagementPolicyFilter
 16    {
 17        /// <summary> Initializes a new instance of ManagementPolicyFilter. </summary>
 18        /// <param name="blobTypes"> An array of predefined enum values. Only blockBlob is supported. </param>
 1219        public ManagementPolicyFilter(IEnumerable<string> blobTypes)
 20        {
 1221            if (blobTypes == null)
 22            {
 023                throw new ArgumentNullException(nameof(blobTypes));
 24            }
 25
 1226            BlobTypes = blobTypes.ToList();
 1227        }
 28
 29        /// <summary> Initializes a new instance of ManagementPolicyFilter. </summary>
 30        /// <param name="prefixMatch"> An array of strings for prefixes to be match. </param>
 31        /// <param name="blobTypes"> An array of predefined enum values. Only blockBlob is supported. </param>
 32        /// <param name="blobIndexMatch"> An array of blob index tag based filters, there can be at most 10 tag filters.
 2433        internal ManagementPolicyFilter(IList<string> prefixMatch, IList<string> blobTypes, IList<TagFilter> blobIndexMa
 34        {
 2435            PrefixMatch = prefixMatch;
 2436            BlobTypes = blobTypes ?? new List<string>();
 2437            BlobIndexMatch = blobIndexMatch;
 2438        }
 39
 40        /// <summary> An array of strings for prefixes to be match. </summary>
 9241        public IList<string> PrefixMatch { get; set; }
 42        /// <summary> An array of predefined enum values. Only blockBlob is supported. </summary>
 6043        public IList<string> BlobTypes { get; }
 44        /// <summary> An array of blob index tag based filters, there can be at most 10 tag filters. </summary>
 3645        public IList<TagFilter> BlobIndexMatch { get; set; }
 46    }
 47}

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\Models\ManagementPolicyFilter.Serialization.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System.Collections.Generic;
 9using System.Text.Json;
 10using Azure.Core;
 11
 12namespace Azure.ResourceManager.Storage.Models
 13{
 14    public partial class ManagementPolicyFilter : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 1218            writer.WriteStartObject();
 1219            if (PrefixMatch != null)
 20            {
 421                writer.WritePropertyName("prefixMatch");
 422                writer.WriteStartArray();
 2423                foreach (var item in PrefixMatch)
 24                {
 825                    writer.WriteStringValue(item);
 26                }
 427                writer.WriteEndArray();
 28            }
 1229            writer.WritePropertyName("blobTypes");
 1230            writer.WriteStartArray();
 4831            foreach (var item in BlobTypes)
 32            {
 1233                writer.WriteStringValue(item);
 34            }
 1235            writer.WriteEndArray();
 1236            if (BlobIndexMatch != null)
 37            {
 038                writer.WritePropertyName("blobIndexMatch");
 039                writer.WriteStartArray();
 040                foreach (var item in BlobIndexMatch)
 41                {
 042                    writer.WriteObjectValue(item);
 43                }
 044                writer.WriteEndArray();
 45            }
 1246            writer.WriteEndObject();
 1247        }
 48
 49        internal static ManagementPolicyFilter DeserializeManagementPolicyFilter(JsonElement element)
 50        {
 2451            IList<string> prefixMatch = default;
 2452            IList<string> blobTypes = default;
 2453            IList<TagFilter> blobIndexMatch = default;
 11254            foreach (var property in element.EnumerateObject())
 55            {
 3256                if (property.NameEquals("prefixMatch"))
 57                {
 858                    if (property.Value.ValueKind == JsonValueKind.Null)
 59                    {
 60                        continue;
 61                    }
 862                    List<string> array = new List<string>();
 4863                    foreach (var item in property.Value.EnumerateArray())
 64                    {
 1665                        if (item.ValueKind == JsonValueKind.Null)
 66                        {
 067                            array.Add(null);
 68                        }
 69                        else
 70                        {
 1671                            array.Add(item.GetString());
 72                        }
 73                    }
 874                    prefixMatch = array;
 875                    continue;
 76                }
 2477                if (property.NameEquals("blobTypes"))
 78                {
 2479                    List<string> array = new List<string>();
 9680                    foreach (var item in property.Value.EnumerateArray())
 81                    {
 2482                        if (item.ValueKind == JsonValueKind.Null)
 83                        {
 084                            array.Add(null);
 85                        }
 86                        else
 87                        {
 2488                            array.Add(item.GetString());
 89                        }
 90                    }
 2491                    blobTypes = array;
 2492                    continue;
 93                }
 094                if (property.NameEquals("blobIndexMatch"))
 95                {
 096                    if (property.Value.ValueKind == JsonValueKind.Null)
 97                    {
 98                        continue;
 99                    }
 0100                    List<TagFilter> array = new List<TagFilter>();
 0101                    foreach (var item in property.Value.EnumerateArray())
 102                    {
 0103                        if (item.ValueKind == JsonValueKind.Null)
 104                        {
 0105                            array.Add(null);
 106                        }
 107                        else
 108                        {
 0109                            array.Add(TagFilter.DeserializeTagFilter(item));
 110                        }
 111                    }
 0112                    blobIndexMatch = array;
 113                    continue;
 114                }
 115            }
 24116            return new ManagementPolicyFilter(prefixMatch, blobTypes, blobIndexMatch);
 117        }
 118    }
 119}