< Summary

Class:Azure.ResourceManager.Resources.Models.ManagementLockObject
Assembly:Azure.ResourceManager.Resources
File(s):C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\ManagementLockObject.cs
C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\ManagementLockObject.Serialization.cs
Covered lines:0
Uncovered lines:80
Coverable lines:80
Total lines:192
Line coverage:0% (0 of 80)
Covered branches:0
Total branches:44
Branch coverage:0% (0 of 44)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%100%
.ctor(...)-0%100%
get_Id()-0%100%
get_Type()-0%100%
get_Name()-0%100%
get_Level()-0%100%
get_Notes()-0%100%
get_Owners()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeManagementLockObject(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\ManagementLockObject.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;
 9
 10namespace Azure.ResourceManager.Resources.Models
 11{
 12    /// <summary> The lock information. </summary>
 13    public partial class ManagementLockObject
 14    {
 15        /// <summary> Initializes a new instance of ManagementLockObject. </summary>
 16        /// <param name="level"> The level of the lock. Possible values are: NotSpecified, CanNotDelete, ReadOnly. CanNo
 017        public ManagementLockObject(LockLevel level)
 18        {
 019            Level = level;
 020        }
 21
 22        /// <summary> Initializes a new instance of ManagementLockObject. </summary>
 23        /// <param name="id"> The resource ID of the lock. </param>
 24        /// <param name="type"> The resource type of the lock - Microsoft.Authorization/locks. </param>
 25        /// <param name="name"> The name of the lock. </param>
 26        /// <param name="level"> The level of the lock. Possible values are: NotSpecified, CanNotDelete, ReadOnly. CanNo
 27        /// <param name="notes"> Notes about the lock. Maximum of 512 characters. </param>
 28        /// <param name="owners"> The owners of the lock. </param>
 029        internal ManagementLockObject(string id, string type, string name, LockLevel level, string notes, IList<Manageme
 30        {
 031            Id = id;
 032            Type = type;
 033            Name = name;
 034            Level = level;
 035            Notes = notes;
 036            Owners = owners;
 037        }
 38
 39        /// <summary> The resource ID of the lock. </summary>
 040        public string Id { get; }
 41        /// <summary> The resource type of the lock - Microsoft.Authorization/locks. </summary>
 042        public string Type { get; }
 43        /// <summary> The name of the lock. </summary>
 044        public string Name { get; }
 45        /// <summary> The level of the lock. Possible values are: NotSpecified, CanNotDelete, ReadOnly. CanNotDelete mea
 046        public LockLevel Level { get; set; }
 47        /// <summary> Notes about the lock. Maximum of 512 characters. </summary>
 048        public string Notes { get; set; }
 49        /// <summary> The owners of the lock. </summary>
 050        public IList<ManagementLockOwner> Owners { get; set; }
 51    }
 52}

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\ManagementLockObject.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.Resources.Models
 13{
 14    public partial class ManagementLockObject : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            if (Id != null)
 20            {
 021                writer.WritePropertyName("id");
 022                writer.WriteStringValue(Id);
 23            }
 024            if (Type != null)
 25            {
 026                writer.WritePropertyName("type");
 027                writer.WriteStringValue(Type);
 28            }
 029            if (Name != null)
 30            {
 031                writer.WritePropertyName("name");
 032                writer.WriteStringValue(Name);
 33            }
 034            writer.WritePropertyName("properties");
 035            writer.WriteStartObject();
 036            writer.WritePropertyName("level");
 037            writer.WriteStringValue(Level.ToString());
 038            if (Notes != null)
 39            {
 040                writer.WritePropertyName("notes");
 041                writer.WriteStringValue(Notes);
 42            }
 043            if (Owners != null)
 44            {
 045                writer.WritePropertyName("owners");
 046                writer.WriteStartArray();
 047                foreach (var item in Owners)
 48                {
 049                    writer.WriteObjectValue(item);
 50                }
 051                writer.WriteEndArray();
 52            }
 053            writer.WriteEndObject();
 054            writer.WriteEndObject();
 055        }
 56
 57        internal static ManagementLockObject DeserializeManagementLockObject(JsonElement element)
 58        {
 059            string id = default;
 060            string type = default;
 061            string name = default;
 062            LockLevel level = default;
 063            string notes = default;
 064            IList<ManagementLockOwner> owners = default;
 065            foreach (var property in element.EnumerateObject())
 66            {
 067                if (property.NameEquals("id"))
 68                {
 069                    if (property.Value.ValueKind == JsonValueKind.Null)
 70                    {
 71                        continue;
 72                    }
 073                    id = property.Value.GetString();
 074                    continue;
 75                }
 076                if (property.NameEquals("type"))
 77                {
 078                    if (property.Value.ValueKind == JsonValueKind.Null)
 79                    {
 80                        continue;
 81                    }
 082                    type = property.Value.GetString();
 083                    continue;
 84                }
 085                if (property.NameEquals("name"))
 86                {
 087                    if (property.Value.ValueKind == JsonValueKind.Null)
 88                    {
 89                        continue;
 90                    }
 091                    name = property.Value.GetString();
 092                    continue;
 93                }
 094                if (property.NameEquals("properties"))
 95                {
 096                    foreach (var property0 in property.Value.EnumerateObject())
 97                    {
 098                        if (property0.NameEquals("level"))
 99                        {
 0100                            level = new LockLevel(property0.Value.GetString());
 0101                            continue;
 102                        }
 0103                        if (property0.NameEquals("notes"))
 104                        {
 0105                            if (property0.Value.ValueKind == JsonValueKind.Null)
 106                            {
 107                                continue;
 108                            }
 0109                            notes = property0.Value.GetString();
 0110                            continue;
 111                        }
 0112                        if (property0.NameEquals("owners"))
 113                        {
 0114                            if (property0.Value.ValueKind == JsonValueKind.Null)
 115                            {
 116                                continue;
 117                            }
 0118                            List<ManagementLockOwner> array = new List<ManagementLockOwner>();
 0119                            foreach (var item in property0.Value.EnumerateArray())
 120                            {
 0121                                if (item.ValueKind == JsonValueKind.Null)
 122                                {
 0123                                    array.Add(null);
 124                                }
 125                                else
 126                                {
 0127                                    array.Add(ManagementLockOwner.DeserializeManagementLockOwner(item));
 128                                }
 129                            }
 0130                            owners = array;
 131                            continue;
 132                        }
 133                    }
 134                    continue;
 135                }
 136            }
 0137            return new ManagementLockObject(id, type, name, level, notes, owners);
 138        }
 139    }
 140}