< Summary

Class:Azure.ResourceManager.Compute.Models.GalleryArtifactPublishingProfileBase
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\GalleryArtifactPublishingProfileBase.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\GalleryArtifactPublishingProfileBase.Serialization.cs
Covered lines:51
Uncovered lines:25
Coverable lines:76
Total lines:189
Line coverage:67.1% (51 of 76)
Covered branches:29
Total branches:44
Branch coverage:65.9% (29 of 44)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_TargetRegions()-100%100%
get_ReplicaCount()-100%100%
get_ExcludeFromLatest()-100%100%
get_PublishedDate()-100%100%
get_EndOfLifeDate()-100%100%
get_StorageAccountType()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeGalleryArtifactPublishingProfileBase(...)-97.22%96.67%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\GalleryArtifactPublishingProfileBase.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.Compute.Models
 12{
 13    /// <summary> Describes the basic gallery artifact publishing profile. </summary>
 14    public partial class GalleryArtifactPublishingProfileBase
 15    {
 16        /// <summary> Initializes a new instance of GalleryArtifactPublishingProfileBase. </summary>
 417        public GalleryArtifactPublishingProfileBase()
 18        {
 419        }
 20
 21        /// <summary> Initializes a new instance of GalleryArtifactPublishingProfileBase. </summary>
 22        /// <param name="targetRegions"> The target regions where the Image Version is going to be replicated to. This p
 23        /// <param name="replicaCount"> The number of replicas of the Image Version to be created per region. This prope
 24        /// <param name="excludeFromLatest"> If set to true, Virtual Machines deployed from the latest version of the Im
 25        /// <param name="publishedDate"> The timestamp for when the gallery Image Version is published. </param>
 26        /// <param name="endOfLifeDate"> The end of life date of the gallery Image Version. This property can be used fo
 27        /// <param name="storageAccountType"> Specifies the storage account type to be used to store the image. This pro
 2428        internal GalleryArtifactPublishingProfileBase(IList<TargetRegion> targetRegions, int? replicaCount, bool? exclud
 29        {
 2430            TargetRegions = targetRegions;
 2431            ReplicaCount = replicaCount;
 2432            ExcludeFromLatest = excludeFromLatest;
 2433            PublishedDate = publishedDate;
 2434            EndOfLifeDate = endOfLifeDate;
 2435            StorageAccountType = storageAccountType;
 2436        }
 37
 38        /// <summary> The target regions where the Image Version is going to be replicated to. This property is updatabl
 6439        public IList<TargetRegion> TargetRegions { get; set; }
 40        /// <summary> The number of replicas of the Image Version to be created per region. This property would take eff
 6041        public int? ReplicaCount { get; set; }
 42        /// <summary> If set to true, Virtual Machines deployed from the latest version of the Image Definition won&apos
 4043        public bool? ExcludeFromLatest { get; set; }
 44        /// <summary> The timestamp for when the gallery Image Version is published. </summary>
 2445        public DateTimeOffset? PublishedDate { get; }
 46        /// <summary> The end of life date of the gallery Image Version. This property can be used for decommissioning p
 7247        public DateTimeOffset? EndOfLifeDate { get; set; }
 48        /// <summary> Specifies the storage account type to be used to store the image. This property is not updatable. 
 6449        public StorageAccountType? StorageAccountType { get; set; }
 50    }
 51}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\GalleryArtifactPublishingProfileBase.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.Compute.Models
 14{
 15    public partial class GalleryArtifactPublishingProfileBase : IUtf8JsonSerializable
 16    {
 17        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 18        {
 019            writer.WriteStartObject();
 020            if (TargetRegions != null)
 21            {
 022                writer.WritePropertyName("targetRegions");
 023                writer.WriteStartArray();
 024                foreach (var item in TargetRegions)
 25                {
 026                    writer.WriteObjectValue(item);
 27                }
 028                writer.WriteEndArray();
 29            }
 030            if (ReplicaCount != null)
 31            {
 032                writer.WritePropertyName("replicaCount");
 033                writer.WriteNumberValue(ReplicaCount.Value);
 34            }
 035            if (ExcludeFromLatest != null)
 36            {
 037                writer.WritePropertyName("excludeFromLatest");
 038                writer.WriteBooleanValue(ExcludeFromLatest.Value);
 39            }
 040            if (PublishedDate != null)
 41            {
 042                writer.WritePropertyName("publishedDate");
 043                writer.WriteStringValue(PublishedDate.Value, "O");
 44            }
 045            if (EndOfLifeDate != null)
 46            {
 047                writer.WritePropertyName("endOfLifeDate");
 048                writer.WriteStringValue(EndOfLifeDate.Value, "O");
 49            }
 050            if (StorageAccountType != null)
 51            {
 052                writer.WritePropertyName("storageAccountType");
 053                writer.WriteStringValue(StorageAccountType.Value.ToString());
 54            }
 055            writer.WriteEndObject();
 056        }
 57
 58        internal static GalleryArtifactPublishingProfileBase DeserializeGalleryArtifactPublishingProfileBase(JsonElement
 59        {
 2460            IList<TargetRegion> targetRegions = default;
 2461            int? replicaCount = default;
 2462            bool? excludeFromLatest = default;
 2463            DateTimeOffset? publishedDate = default;
 2464            DateTimeOffset? endOfLifeDate = default;
 2465            StorageAccountType? storageAccountType = default;
 33666            foreach (var property in element.EnumerateObject())
 67            {
 14468                if (property.NameEquals("targetRegions"))
 69                {
 2470                    if (property.Value.ValueKind == JsonValueKind.Null)
 71                    {
 72                        continue;
 73                    }
 2474                    List<TargetRegion> array = new List<TargetRegion>();
 9675                    foreach (var item in property.Value.EnumerateArray())
 76                    {
 2477                        if (item.ValueKind == JsonValueKind.Null)
 78                        {
 079                            array.Add(null);
 80                        }
 81                        else
 82                        {
 2483                            array.Add(TargetRegion.DeserializeTargetRegion(item));
 84                        }
 85                    }
 2486                    targetRegions = array;
 2487                    continue;
 88                }
 12089                if (property.NameEquals("replicaCount"))
 90                {
 2491                    if (property.Value.ValueKind == JsonValueKind.Null)
 92                    {
 93                        continue;
 94                    }
 2495                    replicaCount = property.Value.GetInt32();
 2496                    continue;
 97                }
 9698                if (property.NameEquals("excludeFromLatest"))
 99                {
 24100                    if (property.Value.ValueKind == JsonValueKind.Null)
 101                    {
 102                        continue;
 103                    }
 24104                    excludeFromLatest = property.Value.GetBoolean();
 24105                    continue;
 106                }
 72107                if (property.NameEquals("publishedDate"))
 108                {
 24109                    if (property.Value.ValueKind == JsonValueKind.Null)
 110                    {
 111                        continue;
 112                    }
 24113                    publishedDate = property.Value.GetDateTimeOffset("O");
 24114                    continue;
 115                }
 48116                if (property.NameEquals("endOfLifeDate"))
 117                {
 24118                    if (property.Value.ValueKind == JsonValueKind.Null)
 119                    {
 120                        continue;
 121                    }
 24122                    endOfLifeDate = property.Value.GetDateTimeOffset("O");
 24123                    continue;
 124                }
 24125                if (property.NameEquals("storageAccountType"))
 126                {
 24127                    if (property.Value.ValueKind == JsonValueKind.Null)
 128                    {
 129                        continue;
 130                    }
 24131                    storageAccountType = new StorageAccountType(property.Value.GetString());
 132                    continue;
 133                }
 134            }
 24135            return new GalleryArtifactPublishingProfileBase(targetRegions, replicaCount, excludeFromLatest, publishedDat
 136        }
 137    }
 138}