< Summary

Class:Azure.ResourceManager.Resources.Models.AzurePowerShellScript
Assembly:Azure.ResourceManager.Resources
File(s):C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\AzurePowerShellScript.cs
C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\AzurePowerShellScript.Serialization.cs
Covered lines:185
Uncovered lines:76
Coverable lines:261
Total lines:537
Line coverage:70.8% (185 of 261)
Covered branches:107
Total branches:154
Branch coverage:69.4% (107 of 154)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-72.73%50%
.ctor(...)-100%100%
get_ContainerSettings()-100%100%
get_StorageAccountSettings()-100%100%
get_CleanupPreference()-100%100%
get_ProvisioningState()-100%100%
get_Status()-100%100%
get_Outputs()-100%100%
get_PrimaryScriptUri()-100%100%
get_SupportingScriptUris()-100%100%
get_ScriptContent()-100%100%
get_Arguments()-100%100%
get_EnvironmentVariables()-100%100%
get_ForceUpdateTag()-100%100%
get_RetentionInterval()-100%100%
get_Timeout()-100%100%
get_AzPowerShellVersion()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-45.24%45.45%
DeserializeAzurePowerShellScript(...)-79.7%80.77%

File(s)

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\AzurePowerShellScript.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> Object model for the Azure PowerShell script. </summary>
 14    public partial class AzurePowerShellScript : DeploymentScript
 15    {
 16        /// <summary> Initializes a new instance of AzurePowerShellScript. </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>
 19        /// <param name="retentionInterval"> Interval for which the service retains the script resource after it reaches
 20        /// <param name="azPowerShellVersion"> Azure PowerShell module version to be used. </param>
 1221        public AzurePowerShellScript(ManagedServiceIdentity identity, string location, TimeSpan retentionInterval, strin
 22        {
 1223            if (identity == null)
 24            {
 025                throw new ArgumentNullException(nameof(identity));
 26            }
 1227            if (location == null)
 28            {
 029                throw new ArgumentNullException(nameof(location));
 30            }
 1231            if (azPowerShellVersion == null)
 32            {
 033                throw new ArgumentNullException(nameof(azPowerShellVersion));
 34            }
 35
 1236            RetentionInterval = retentionInterval;
 1237            AzPowerShellVersion = azPowerShellVersion;
 1238            Kind = ScriptType.AzurePowerShell;
 1239        }
 40
 41        /// <summary> Initializes a new instance of AzurePowerShellScript. </summary>
 42        /// <param name="id"> String Id used to locate any resource on Azure. </param>
 43        /// <param name="name"> Name of this resource. </param>
 44        /// <param name="type"> Type of this resource. </param>
 45        /// <param name="identity"> Managed identity to be used for this deployment script. Currently, only user-assigne
 46        /// <param name="location"> The location of the ACI and the storage account for the deployment script. </param>
 47        /// <param name="tags"> Resource tags. </param>
 48        /// <param name="kind"> Type of the script. </param>
 49        /// <param name="systemData"> The system metadata related to this resource. </param>
 50        /// <param name="containerSettings"> Container settings. </param>
 51        /// <param name="storageAccountSettings"> Storage Account settings. </param>
 52        /// <param name="cleanupPreference"> The clean up preference when the script execution gets in a terminal state.
 53        /// <param name="provisioningState"> State of the script execution. This only appears in the response. </param>
 54        /// <param name="status"> Contains the results of script execution. </param>
 55        /// <param name="outputs"> List of script outputs. </param>
 56        /// <param name="primaryScriptUri"> Uri for the script. This is the entry point for the external script. </param
 57        /// <param name="supportingScriptUris"> Supporting files for the external script. </param>
 58        /// <param name="scriptContent"> Script body. </param>
 59        /// <param name="arguments"> Command line arguments to pass to the script. Arguments are separated by spaces. ex
 60        /// <param name="environmentVariables"> The environment variables to pass over to the script. </param>
 61        /// <param name="forceUpdateTag"> Gets or sets how the deployment script should be forced to execute even if the
 62        /// <param name="retentionInterval"> Interval for which the service retains the script resource after it reaches
 63        /// <param name="timeout"> Maximum allowed script execution time specified in ISO 8601 format. Default value is 
 64        /// <param name="azPowerShellVersion"> Azure PowerShell module version to be used. </param>
 7465        internal AzurePowerShellScript(string id, string name, string type, ManagedServiceIdentity identity, string loca
 66        {
 7467            ContainerSettings = containerSettings;
 7468            StorageAccountSettings = storageAccountSettings;
 7469            CleanupPreference = cleanupPreference;
 7470            ProvisioningState = provisioningState;
 7471            Status = status;
 7472            Outputs = outputs;
 7473            PrimaryScriptUri = primaryScriptUri;
 7474            SupportingScriptUris = supportingScriptUris;
 7475            ScriptContent = scriptContent;
 7476            Arguments = arguments;
 7477            EnvironmentVariables = environmentVariables;
 7478            ForceUpdateTag = forceUpdateTag;
 7479            RetentionInterval = retentionInterval;
 7480            Timeout = timeout;
 7481            AzPowerShellVersion = azPowerShellVersion;
 7482            Kind = kind;
 7483        }
 84
 85        /// <summary> Container settings. </summary>
 9886        public ContainerConfiguration ContainerSettings { get; set; }
 87        /// <summary> Storage Account settings. </summary>
 9888        public StorageAccountConfiguration StorageAccountSettings { get; set; }
 89        /// <summary> The clean up preference when the script execution gets in a terminal state. Default setting is &ap
 10290        public CleanupOptions? CleanupPreference { get; set; }
 91        /// <summary> State of the script execution. This only appears in the response. </summary>
 8292        public ScriptProvisioningState? ProvisioningState { get; }
 93        /// <summary> Contains the results of script execution. </summary>
 5294        public ScriptStatus Status { get; }
 95        /// <summary> List of script outputs. </summary>
 2896        public IDictionary<string, object> Outputs { get; }
 97        /// <summary> Uri for the script. This is the entry point for the external script. </summary>
 9898        public string PrimaryScriptUri { get; set; }
 99        /// <summary> Supporting files for the external script. </summary>
 98100        public IList<string> SupportingScriptUris { get; set; }
 101        /// <summary> Script body. </summary>
 146102        public string ScriptContent { get; set; }
 103        /// <summary> Command line arguments to pass to the script. Arguments are separated by spaces. ex: -Name blue* -
 134104        public string Arguments { get; set; }
 105        /// <summary> The environment variables to pass over to the script. </summary>
 98106        public IList<EnvironmentVariable> EnvironmentVariables { get; set; }
 107        /// <summary> Gets or sets how the deployment script should be forced to execute even if the script resource has
 98108        public string ForceUpdateTag { get; set; }
 109        /// <summary> Interval for which the service retains the script resource after it reaches a terminal state. Reso
 122110        public TimeSpan RetentionInterval { get; set; }
 111        /// <summary> Maximum allowed script execution time specified in ISO 8601 format. Default value is PT1H. </summa
 102112        public TimeSpan? Timeout { get; set; }
 113        /// <summary> Azure PowerShell module version to be used. </summary>
 130114        public string AzPowerShellVersion { get; set; }
 115    }
 116}

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\AzurePowerShellScript.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;
 9using System.Collections.Generic;
 10using System.Text.Json;
 11using Azure.Core;
 12
 13namespace Azure.ResourceManager.Resources.Models
 14{
 15    public partial class AzurePowerShellScript : IUtf8JsonSerializable
 16    {
 17        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 18        {
 2419            writer.WriteStartObject();
 2420            writer.WritePropertyName("identity");
 2421            writer.WriteObjectValue(Identity);
 2422            writer.WritePropertyName("location");
 2423            writer.WriteStringValue(Location);
 2424            if (Tags != null)
 25            {
 026                writer.WritePropertyName("tags");
 027                writer.WriteStartObject();
 028                foreach (var item in Tags)
 29                {
 030                    writer.WritePropertyName(item.Key);
 031                    writer.WriteStringValue(item.Value);
 32                }
 033                writer.WriteEndObject();
 34            }
 2435            writer.WritePropertyName("kind");
 2436            writer.WriteStringValue(Kind.ToString());
 2437            if (SystemData != null)
 38            {
 039                writer.WritePropertyName("systemData");
 040                writer.WriteObjectValue(SystemData);
 41            }
 2442            if (Id != null)
 43            {
 044                writer.WritePropertyName("id");
 045                writer.WriteStringValue(Id);
 46            }
 2447            if (Name != null)
 48            {
 049                writer.WritePropertyName("name");
 050                writer.WriteStringValue(Name);
 51            }
 2452            if (Type != null)
 53            {
 054                writer.WritePropertyName("type");
 055                writer.WriteStringValue(Type);
 56            }
 2457            writer.WritePropertyName("properties");
 2458            writer.WriteStartObject();
 2459            if (ContainerSettings != null)
 60            {
 061                writer.WritePropertyName("containerSettings");
 062                writer.WriteObjectValue(ContainerSettings);
 63            }
 2464            if (StorageAccountSettings != null)
 65            {
 066                writer.WritePropertyName("storageAccountSettings");
 067                writer.WriteObjectValue(StorageAccountSettings);
 68            }
 2469            if (CleanupPreference != null)
 70            {
 071                writer.WritePropertyName("cleanupPreference");
 072                writer.WriteStringValue(CleanupPreference.Value.ToString());
 73            }
 2474            if (ProvisioningState != null)
 75            {
 076                writer.WritePropertyName("provisioningState");
 077                writer.WriteStringValue(ProvisioningState.Value.ToString());
 78            }
 2479            if (Status != null)
 80            {
 081                writer.WritePropertyName("status");
 082                writer.WriteObjectValue(Status);
 83            }
 2484            if (Outputs != null)
 85            {
 086                writer.WritePropertyName("outputs");
 087                writer.WriteStartObject();
 088                foreach (var item in Outputs)
 89                {
 090                    writer.WritePropertyName(item.Key);
 091                    writer.WriteObjectValue(item.Value);
 92                }
 093                writer.WriteEndObject();
 94            }
 2495            if (PrimaryScriptUri != null)
 96            {
 097                writer.WritePropertyName("primaryScriptUri");
 098                writer.WriteStringValue(PrimaryScriptUri);
 99            }
 24100            if (SupportingScriptUris != null)
 101            {
 0102                writer.WritePropertyName("supportingScriptUris");
 0103                writer.WriteStartArray();
 0104                foreach (var item in SupportingScriptUris)
 105                {
 0106                    writer.WriteStringValue(item);
 107                }
 0108                writer.WriteEndArray();
 109            }
 24110            if (ScriptContent != null)
 111            {
 24112                writer.WritePropertyName("scriptContent");
 24113                writer.WriteStringValue(ScriptContent);
 114            }
 24115            if (Arguments != null)
 116            {
 16117                writer.WritePropertyName("arguments");
 16118                writer.WriteStringValue(Arguments);
 119            }
 24120            if (EnvironmentVariables != null)
 121            {
 0122                writer.WritePropertyName("environmentVariables");
 0123                writer.WriteStartArray();
 0124                foreach (var item in EnvironmentVariables)
 125                {
 0126                    writer.WriteObjectValue(item);
 127                }
 0128                writer.WriteEndArray();
 129            }
 24130            if (ForceUpdateTag != null)
 131            {
 0132                writer.WritePropertyName("forceUpdateTag");
 0133                writer.WriteStringValue(ForceUpdateTag);
 134            }
 24135            writer.WritePropertyName("retentionInterval");
 24136            writer.WriteStringValue(RetentionInterval, "P");
 24137            if (Timeout != null)
 138            {
 0139                writer.WritePropertyName("timeout");
 0140                writer.WriteStringValue(Timeout.Value, "P");
 141            }
 24142            writer.WritePropertyName("azPowerShellVersion");
 24143            writer.WriteStringValue(AzPowerShellVersion);
 24144            writer.WriteEndObject();
 24145            writer.WriteEndObject();
 24146        }
 147
 148        internal static AzurePowerShellScript DeserializeAzurePowerShellScript(JsonElement element)
 149        {
 74150            ManagedServiceIdentity identity = default;
 74151            string location = default;
 74152            IDictionary<string, string> tags = default;
 74153            ScriptType kind = default;
 74154            SystemData systemData = default;
 74155            string id = default;
 74156            string name = default;
 74157            string type = default;
 74158            ContainerConfiguration containerSettings = default;
 74159            StorageAccountConfiguration storageAccountSettings = default;
 74160            CleanupOptions? cleanupPreference = default;
 74161            ScriptProvisioningState? provisioningState = default;
 74162            ScriptStatus status = default;
 74163            IDictionary<string, object> outputs = default;
 74164            string primaryScriptUri = default;
 74165            IList<string> supportingScriptUris = default;
 74166            string scriptContent = default;
 74167            string arguments = default;
 74168            IList<EnvironmentVariable> environmentVariables = default;
 74169            string forceUpdateTag = default;
 74170            TimeSpan retentionInterval = default;
 74171            TimeSpan? timeout = default;
 74172            string azPowerShellVersion = default;
 1444173            foreach (var property in element.EnumerateObject())
 174            {
 648175                if (property.NameEquals("identity"))
 176                {
 74177                    identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value);
 74178                    continue;
 179                }
 574180                if (property.NameEquals("location"))
 181                {
 74182                    location = property.Value.GetString();
 74183                    continue;
 184                }
 500185                if (property.NameEquals("tags"))
 186                {
 56187                    if (property.Value.ValueKind == JsonValueKind.Null)
 188                    {
 189                        continue;
 190                    }
 56191                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 224192                    foreach (var property0 in property.Value.EnumerateObject())
 193                    {
 56194                        if (property0.Value.ValueKind == JsonValueKind.Null)
 195                        {
 0196                            dictionary.Add(property0.Name, null);
 197                        }
 198                        else
 199                        {
 56200                            dictionary.Add(property0.Name, property0.Value.GetString());
 201                        }
 202                    }
 56203                    tags = dictionary;
 56204                    continue;
 205                }
 444206                if (property.NameEquals("kind"))
 207                {
 74208                    kind = new ScriptType(property.Value.GetString());
 74209                    continue;
 210                }
 370211                if (property.NameEquals("systemData"))
 212                {
 74213                    if (property.Value.ValueKind == JsonValueKind.Null)
 214                    {
 215                        continue;
 216                    }
 74217                    systemData = SystemData.DeserializeSystemData(property.Value);
 74218                    continue;
 219                }
 296220                if (property.NameEquals("id"))
 221                {
 74222                    if (property.Value.ValueKind == JsonValueKind.Null)
 223                    {
 224                        continue;
 225                    }
 74226                    id = property.Value.GetString();
 74227                    continue;
 228                }
 222229                if (property.NameEquals("name"))
 230                {
 74231                    if (property.Value.ValueKind == JsonValueKind.Null)
 232                    {
 233                        continue;
 234                    }
 74235                    name = property.Value.GetString();
 74236                    continue;
 237                }
 148238                if (property.NameEquals("type"))
 239                {
 74240                    if (property.Value.ValueKind == JsonValueKind.Null)
 241                    {
 242                        continue;
 243                    }
 74244                    type = property.Value.GetString();
 74245                    continue;
 246                }
 74247                if (property.NameEquals("properties"))
 248                {
 1428249                    foreach (var property0 in property.Value.EnumerateObject())
 250                    {
 640251                        if (property0.NameEquals("containerSettings"))
 252                        {
 74253                            if (property0.Value.ValueKind == JsonValueKind.Null)
 254                            {
 255                                continue;
 256                            }
 74257                            containerSettings = ContainerConfiguration.DeserializeContainerConfiguration(property0.Value
 74258                            continue;
 259                        }
 566260                        if (property0.NameEquals("storageAccountSettings"))
 261                        {
 0262                            if (property0.Value.ValueKind == JsonValueKind.Null)
 263                            {
 264                                continue;
 265                            }
 0266                            storageAccountSettings = StorageAccountConfiguration.DeserializeStorageAccountConfiguration(
 0267                            continue;
 268                        }
 566269                        if (property0.NameEquals("cleanupPreference"))
 270                        {
 74271                            if (property0.Value.ValueKind == JsonValueKind.Null)
 272                            {
 273                                continue;
 274                            }
 74275                            cleanupPreference = new CleanupOptions(property0.Value.GetString());
 74276                            continue;
 277                        }
 492278                        if (property0.NameEquals("provisioningState"))
 279                        {
 74280                            if (property0.Value.ValueKind == JsonValueKind.Null)
 281                            {
 282                                continue;
 283                            }
 74284                            provisioningState = new ScriptProvisioningState(property0.Value.GetString());
 74285                            continue;
 286                        }
 418287                        if (property0.NameEquals("status"))
 288                        {
 74289                            if (property0.Value.ValueKind == JsonValueKind.Null)
 290                            {
 291                                continue;
 292                            }
 74293                            status = ScriptStatus.DeserializeScriptStatus(property0.Value);
 74294                            continue;
 295                        }
 344296                        if (property0.NameEquals("outputs"))
 297                        {
 24298                            if (property0.Value.ValueKind == JsonValueKind.Null)
 299                            {
 300                                continue;
 301                            }
 24302                            Dictionary<string, object> dictionary = new Dictionary<string, object>();
 96303                            foreach (var property1 in property0.Value.EnumerateObject())
 304                            {
 24305                                if (property1.Value.ValueKind == JsonValueKind.Null)
 306                                {
 0307                                    dictionary.Add(property1.Name, null);
 308                                }
 309                                else
 310                                {
 24311                                    dictionary.Add(property1.Name, property1.Value.GetObject());
 312                                }
 313                            }
 24314                            outputs = dictionary;
 24315                            continue;
 316                        }
 320317                        if (property0.NameEquals("primaryScriptUri"))
 318                        {
 0319                            if (property0.Value.ValueKind == JsonValueKind.Null)
 320                            {
 321                                continue;
 322                            }
 0323                            primaryScriptUri = property0.Value.GetString();
 0324                            continue;
 325                        }
 320326                        if (property0.NameEquals("supportingScriptUris"))
 327                        {
 0328                            if (property0.Value.ValueKind == JsonValueKind.Null)
 329                            {
 330                                continue;
 331                            }
 0332                            List<string> array = new List<string>();
 0333                            foreach (var item in property0.Value.EnumerateArray())
 334                            {
 0335                                if (item.ValueKind == JsonValueKind.Null)
 336                                {
 0337                                    array.Add(null);
 338                                }
 339                                else
 340                                {
 0341                                    array.Add(item.GetString());
 342                                }
 343                            }
 0344                            supportingScriptUris = array;
 0345                            continue;
 346                        }
 320347                        if (property0.NameEquals("scriptContent"))
 348                        {
 74349                            if (property0.Value.ValueKind == JsonValueKind.Null)
 350                            {
 351                                continue;
 352                            }
 74353                            scriptContent = property0.Value.GetString();
 74354                            continue;
 355                        }
 246356                        if (property0.NameEquals("arguments"))
 357                        {
 24358                            if (property0.Value.ValueKind == JsonValueKind.Null)
 359                            {
 360                                continue;
 361                            }
 24362                            arguments = property0.Value.GetString();
 24363                            continue;
 364                        }
 222365                        if (property0.NameEquals("environmentVariables"))
 366                        {
 0367                            if (property0.Value.ValueKind == JsonValueKind.Null)
 368                            {
 369                                continue;
 370                            }
 0371                            List<EnvironmentVariable> array = new List<EnvironmentVariable>();
 0372                            foreach (var item in property0.Value.EnumerateArray())
 373                            {
 0374                                if (item.ValueKind == JsonValueKind.Null)
 375                                {
 0376                                    array.Add(null);
 377                                }
 378                                else
 379                                {
 0380                                    array.Add(EnvironmentVariable.DeserializeEnvironmentVariable(item));
 381                                }
 382                            }
 0383                            environmentVariables = array;
 0384                            continue;
 385                        }
 222386                        if (property0.NameEquals("forceUpdateTag"))
 387                        {
 0388                            if (property0.Value.ValueKind == JsonValueKind.Null)
 389                            {
 390                                continue;
 391                            }
 0392                            forceUpdateTag = property0.Value.GetString();
 0393                            continue;
 394                        }
 222395                        if (property0.NameEquals("retentionInterval"))
 396                        {
 74397                            retentionInterval = property0.Value.GetTimeSpan("P");
 74398                            continue;
 399                        }
 148400                        if (property0.NameEquals("timeout"))
 401                        {
 74402                            if (property0.Value.ValueKind == JsonValueKind.Null)
 403                            {
 404                                continue;
 405                            }
 74406                            timeout = property0.Value.GetTimeSpan("P");
 74407                            continue;
 408                        }
 74409                        if (property0.NameEquals("azPowerShellVersion"))
 410                        {
 74411                            azPowerShellVersion = property0.Value.GetString();
 412                            continue;
 413                        }
 414                    }
 415                    continue;
 416                }
 417            }
 74418            return new AzurePowerShellScript(id, name, type, identity, location, tags, kind, systemData, containerSettin
 419        }
 420    }
 421}