< Summary

Class:Azure.ResourceManager.Resources.Models.DeploymentScript
Assembly:Azure.ResourceManager.Resources
File(s):C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\DeploymentScript.cs
C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\DeploymentScript.Serialization.cs
Covered lines:22
Uncovered lines:74
Coverable lines:96
Total lines:219
Line coverage:22.9% (22 of 96)
Covered branches:5
Total branches:54
Branch coverage:9.2% (5 of 54)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-77.78%50%
.ctor(...)-100%100%
get_Identity()-100%100%
get_Location()-100%100%
get_Tags()-100%100%
get_Kind()-100%100%
get_SystemData()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeDeploymentScript(...)-6.38%7.89%

File(s)

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\DeploymentScript.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;
 10
 11namespace Azure.ResourceManager.Resources.Models
 12{
 13    /// <summary> Deployment script object. </summary>
 14    public partial class DeploymentScript : AzureResourceBase
 15    {
 16        /// <summary> Initializes a new instance of DeploymentScript. </summary>
 17        /// <param name="identity"> Managed identity to be used for this deployment script. Currently, only user-assigne
 18        /// <param name="location"> The location of the ACI and the storage account for the deployment script. </param>
 1219        public DeploymentScript(ManagedServiceIdentity identity, string location)
 20        {
 1221            if (identity == null)
 22            {
 023                throw new ArgumentNullException(nameof(identity));
 24            }
 1225            if (location == null)
 26            {
 027                throw new ArgumentNullException(nameof(location));
 28            }
 29
 1230            Identity = identity;
 1231            Location = location;
 1232            Kind = new ScriptType("DeploymentScript");
 1233        }
 34
 35        /// <summary> Initializes a new instance of DeploymentScript. </summary>
 36        /// <param name="id"> String Id used to locate any resource on Azure. </param>
 37        /// <param name="name"> Name of this resource. </param>
 38        /// <param name="type"> Type of this resource. </param>
 39        /// <param name="identity"> Managed identity to be used for this deployment script. Currently, only user-assigne
 40        /// <param name="location"> The location of the ACI and the storage account for the deployment script. </param>
 41        /// <param name="tags"> Resource tags. </param>
 42        /// <param name="kind"> Type of the script. </param>
 43        /// <param name="systemData"> The system metadata related to this resource. </param>
 7444        internal DeploymentScript(string id, string name, string type, ManagedServiceIdentity identity, string location,
 45        {
 7446            Identity = identity;
 7447            Location = location;
 7448            Tags = tags;
 7449            Kind = kind;
 7450            SystemData = systemData;
 7451        }
 52
 53        /// <summary> Managed identity to be used for this deployment script. Currently, only user-assigned MSI is suppo
 13854        public ManagedServiceIdentity Identity { get; set; }
 55        /// <summary> The location of the ACI and the storage account for the deployment script. </summary>
 11856        public string Location { get; set; }
 57        /// <summary> Resource tags. </summary>
 9858        public IDictionary<string, string> Tags { get; set; }
 59        /// <summary> Type of the script. </summary>
 19660        internal ScriptType Kind { get; set; }
 61        /// <summary> The system metadata related to this resource. </summary>
 2462        public SystemData SystemData { get; }
 63    }
 64}

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\DeploymentScript.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 DeploymentScript : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            writer.WritePropertyName("identity");
 020            writer.WriteObjectValue(Identity);
 021            writer.WritePropertyName("location");
 022            writer.WriteStringValue(Location);
 023            if (Tags != null)
 24            {
 025                writer.WritePropertyName("tags");
 026                writer.WriteStartObject();
 027                foreach (var item in Tags)
 28                {
 029                    writer.WritePropertyName(item.Key);
 030                    writer.WriteStringValue(item.Value);
 31                }
 032                writer.WriteEndObject();
 33            }
 034            writer.WritePropertyName("kind");
 035            writer.WriteStringValue(Kind.ToString());
 036            if (SystemData != null)
 37            {
 038                writer.WritePropertyName("systemData");
 039                writer.WriteObjectValue(SystemData);
 40            }
 041            if (Id != null)
 42            {
 043                writer.WritePropertyName("id");
 044                writer.WriteStringValue(Id);
 45            }
 046            if (Name != null)
 47            {
 048                writer.WritePropertyName("name");
 049                writer.WriteStringValue(Name);
 50            }
 051            if (Type != null)
 52            {
 053                writer.WritePropertyName("type");
 054                writer.WriteStringValue(Type);
 55            }
 056            writer.WriteEndObject();
 057        }
 58
 59        internal static DeploymentScript DeserializeDeploymentScript(JsonElement element)
 60        {
 7461            if (element.TryGetProperty("kind", out JsonElement discriminator))
 62            {
 7463                switch (discriminator.GetString())
 64                {
 065                    case "AzureCLI": return AzureCliScript.DeserializeAzureCliScript(element);
 7466                    case "AzurePowerShell": return AzurePowerShellScript.DeserializeAzurePowerShellScript(element);
 67                }
 68            }
 069            ManagedServiceIdentity identity = default;
 070            string location = default;
 071            IDictionary<string, string> tags = default;
 072            ScriptType kind = default;
 073            SystemData systemData = default;
 074            string id = default;
 075            string name = default;
 076            string type = default;
 077            foreach (var property in element.EnumerateObject())
 78            {
 079                if (property.NameEquals("identity"))
 80                {
 081                    identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value);
 082                    continue;
 83                }
 084                if (property.NameEquals("location"))
 85                {
 086                    location = property.Value.GetString();
 087                    continue;
 88                }
 089                if (property.NameEquals("tags"))
 90                {
 091                    if (property.Value.ValueKind == JsonValueKind.Null)
 92                    {
 93                        continue;
 94                    }
 095                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 096                    foreach (var property0 in property.Value.EnumerateObject())
 97                    {
 098                        if (property0.Value.ValueKind == JsonValueKind.Null)
 99                        {
 0100                            dictionary.Add(property0.Name, null);
 101                        }
 102                        else
 103                        {
 0104                            dictionary.Add(property0.Name, property0.Value.GetString());
 105                        }
 106                    }
 0107                    tags = dictionary;
 0108                    continue;
 109                }
 0110                if (property.NameEquals("kind"))
 111                {
 0112                    kind = new ScriptType(property.Value.GetString());
 0113                    continue;
 114                }
 0115                if (property.NameEquals("systemData"))
 116                {
 0117                    if (property.Value.ValueKind == JsonValueKind.Null)
 118                    {
 119                        continue;
 120                    }
 0121                    systemData = SystemData.DeserializeSystemData(property.Value);
 0122                    continue;
 123                }
 0124                if (property.NameEquals("id"))
 125                {
 0126                    if (property.Value.ValueKind == JsonValueKind.Null)
 127                    {
 128                        continue;
 129                    }
 0130                    id = property.Value.GetString();
 0131                    continue;
 132                }
 0133                if (property.NameEquals("name"))
 134                {
 0135                    if (property.Value.ValueKind == JsonValueKind.Null)
 136                    {
 137                        continue;
 138                    }
 0139                    name = property.Value.GetString();
 0140                    continue;
 141                }
 0142                if (property.NameEquals("type"))
 143                {
 0144                    if (property.Value.ValueKind == JsonValueKind.Null)
 145                    {
 146                        continue;
 147                    }
 0148                    type = property.Value.GetString();
 149                    continue;
 150                }
 151            }
 0152            return new DeploymentScript(id, name, type, identity, location, tags, kind, systemData);
 153        }
 154    }
 155}