< Summary

Class:Azure.ResourceManager.Network.Models.Delegation
Assembly:Azure.ResourceManager.Network
File(s):C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\Delegation.cs
C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\Delegation.Serialization.cs
Covered lines:0
Uncovered lines:79
Coverable lines:79
Total lines:194
Line coverage:0% (0 of 79)
Covered branches:0
Total branches:48
Branch coverage:0% (0 of 48)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-0%100%
get_Name()-0%100%
get_Etag()-0%100%
get_ServiceName()-0%100%
get_Actions()-0%100%
get_ProvisioningState()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeDelegation(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\Delegation.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.Network.Models
 11{
 12    /// <summary> Details the service to which the subnet is delegated. </summary>
 13    public partial class Delegation : SubResource
 14    {
 15        /// <summary> Initializes a new instance of Delegation. </summary>
 016        public Delegation()
 17        {
 018        }
 19
 20        /// <summary> Initializes a new instance of Delegation. </summary>
 21        /// <param name="id"> Resource ID. </param>
 22        /// <param name="name"> The name of the resource that is unique within a subnet. This name can be used to access
 23        /// <param name="etag"> A unique read-only string that changes whenever the resource is updated. </param>
 24        /// <param name="serviceName"> The name of the service to whom the subnet should be delegated (e.g. Microsoft.Sq
 25        /// <param name="actions"> The actions permitted to the service upon delegation. </param>
 26        /// <param name="provisioningState"> The provisioning state of the service delegation resource. </param>
 027        internal Delegation(string id, string name, string etag, string serviceName, IList<string> actions, Provisioning
 28        {
 029            Name = name;
 030            Etag = etag;
 031            ServiceName = serviceName;
 032            Actions = actions;
 033            ProvisioningState = provisioningState;
 034        }
 35
 36        /// <summary> The name of the resource that is unique within a subnet. This name can be used to access the resou
 037        public string Name { get; set; }
 38        /// <summary> A unique read-only string that changes whenever the resource is updated. </summary>
 039        public string Etag { get; }
 40        /// <summary> The name of the service to whom the subnet should be delegated (e.g. Microsoft.Sql/servers). </sum
 041        public string ServiceName { get; set; }
 42        /// <summary> The actions permitted to the service upon delegation. </summary>
 043        public IList<string> Actions { get; }
 44        /// <summary> The provisioning state of the service delegation resource. </summary>
 045        public ProvisioningState? ProvisioningState { get; }
 46    }
 47}

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\Models\Delegation.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.Network.Models
 13{
 14    public partial class Delegation : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            if (Name != null)
 20            {
 021                writer.WritePropertyName("name");
 022                writer.WriteStringValue(Name);
 23            }
 024            if (Etag != null)
 25            {
 026                writer.WritePropertyName("etag");
 027                writer.WriteStringValue(Etag);
 28            }
 029            if (Id != null)
 30            {
 031                writer.WritePropertyName("id");
 032                writer.WriteStringValue(Id);
 33            }
 034            writer.WritePropertyName("properties");
 035            writer.WriteStartObject();
 036            if (ServiceName != null)
 37            {
 038                writer.WritePropertyName("serviceName");
 039                writer.WriteStringValue(ServiceName);
 40            }
 041            if (Actions != null)
 42            {
 043                writer.WritePropertyName("actions");
 044                writer.WriteStartArray();
 045                foreach (var item in Actions)
 46                {
 047                    writer.WriteStringValue(item);
 48                }
 049                writer.WriteEndArray();
 50            }
 051            if (ProvisioningState != null)
 52            {
 053                writer.WritePropertyName("provisioningState");
 054                writer.WriteStringValue(ProvisioningState.Value.ToString());
 55            }
 056            writer.WriteEndObject();
 057            writer.WriteEndObject();
 058        }
 59
 60        internal static Delegation DeserializeDelegation(JsonElement element)
 61        {
 062            string name = default;
 063            string etag = default;
 064            string id = default;
 065            string serviceName = default;
 066            IList<string> actions = default;
 067            ProvisioningState? provisioningState = default;
 068            foreach (var property in element.EnumerateObject())
 69            {
 070                if (property.NameEquals("name"))
 71                {
 072                    if (property.Value.ValueKind == JsonValueKind.Null)
 73                    {
 74                        continue;
 75                    }
 076                    name = property.Value.GetString();
 077                    continue;
 78                }
 079                if (property.NameEquals("etag"))
 80                {
 081                    if (property.Value.ValueKind == JsonValueKind.Null)
 82                    {
 83                        continue;
 84                    }
 085                    etag = property.Value.GetString();
 086                    continue;
 87                }
 088                if (property.NameEquals("id"))
 89                {
 090                    if (property.Value.ValueKind == JsonValueKind.Null)
 91                    {
 92                        continue;
 93                    }
 094                    id = property.Value.GetString();
 095                    continue;
 96                }
 097                if (property.NameEquals("properties"))
 98                {
 099                    foreach (var property0 in property.Value.EnumerateObject())
 100                    {
 0101                        if (property0.NameEquals("serviceName"))
 102                        {
 0103                            if (property0.Value.ValueKind == JsonValueKind.Null)
 104                            {
 105                                continue;
 106                            }
 0107                            serviceName = property0.Value.GetString();
 0108                            continue;
 109                        }
 0110                        if (property0.NameEquals("actions"))
 111                        {
 0112                            if (property0.Value.ValueKind == JsonValueKind.Null)
 113                            {
 114                                continue;
 115                            }
 0116                            List<string> array = new List<string>();
 0117                            foreach (var item in property0.Value.EnumerateArray())
 118                            {
 0119                                if (item.ValueKind == JsonValueKind.Null)
 120                                {
 0121                                    array.Add(null);
 122                                }
 123                                else
 124                                {
 0125                                    array.Add(item.GetString());
 126                                }
 127                            }
 0128                            actions = array;
 0129                            continue;
 130                        }
 0131                        if (property0.NameEquals("provisioningState"))
 132                        {
 0133                            if (property0.Value.ValueKind == JsonValueKind.Null)
 134                            {
 135                                continue;
 136                            }
 0137                            provisioningState = new ProvisioningState(property0.Value.GetString());
 138                            continue;
 139                        }
 140                    }
 141                    continue;
 142                }
 143            }
 0144            return new Delegation(id, name, etag, serviceName, actions, provisioningState);
 145        }
 146    }
 147}