< Summary

Class:Azure.ResourceManager.Compute.Models.GalleryImageVersionPublishingProfile
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\GalleryImageVersionPublishingProfile.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\GalleryImageVersionPublishingProfile.Serialization.cs
Covered lines:22
Uncovered lines:42
Coverable lines:64
Total lines:170
Line coverage:34.3% (22 of 64)
Covered branches:12
Total branches:44
Branch coverage:27.2% (12 of 44)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-83.33%85.71%
DeserializeGalleryImageVersionPublishingProfile(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\GalleryImageVersionPublishingProfile.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> The publishing profile of a gallery Image Version. </summary>
 14    public partial class GalleryImageVersionPublishingProfile : GalleryArtifactPublishingProfileBase
 15    {
 16        /// <summary> Initializes a new instance of GalleryImageVersionPublishingProfile. </summary>
 417        public GalleryImageVersionPublishingProfile()
 18        {
 419        }
 20
 21        /// <summary> Initializes a new instance of GalleryImageVersionPublishingProfile. </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
 028        internal GalleryImageVersionPublishingProfile(IList<TargetRegion> targetRegions, int? replicaCount, bool? exclud
 29        {
 030        }
 31    }
 32}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\GalleryImageVersionPublishingProfile.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 GalleryImageVersionPublishingProfile : IUtf8JsonSerializable
 16    {
 17        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 18        {
 1619            writer.WriteStartObject();
 1620            if (TargetRegions != null)
 21            {
 1622                writer.WritePropertyName("targetRegions");
 1623                writer.WriteStartArray();
 6424                foreach (var item in TargetRegions)
 25                {
 1626                    writer.WriteObjectValue(item);
 27                }
 1628                writer.WriteEndArray();
 29            }
 1630            if (ReplicaCount != null)
 31            {
 1632                writer.WritePropertyName("replicaCount");
 1633                writer.WriteNumberValue(ReplicaCount.Value);
 34            }
 1635            if (ExcludeFromLatest != null)
 36            {
 037                writer.WritePropertyName("excludeFromLatest");
 038                writer.WriteBooleanValue(ExcludeFromLatest.Value);
 39            }
 1640            if (PublishedDate != null)
 41            {
 042                writer.WritePropertyName("publishedDate");
 043                writer.WriteStringValue(PublishedDate.Value, "O");
 44            }
 1645            if (EndOfLifeDate != null)
 46            {
 1647                writer.WritePropertyName("endOfLifeDate");
 1648                writer.WriteStringValue(EndOfLifeDate.Value, "O");
 49            }
 1650            if (StorageAccountType != null)
 51            {
 1652                writer.WritePropertyName("storageAccountType");
 1653                writer.WriteStringValue(StorageAccountType.Value.ToString());
 54            }
 1655            writer.WriteEndObject();
 1656        }
 57
 58        internal static GalleryImageVersionPublishingProfile DeserializeGalleryImageVersionPublishingProfile(JsonElement
 59        {
 060            IList<TargetRegion> targetRegions = default;
 061            int? replicaCount = default;
 062            bool? excludeFromLatest = default;
 063            DateTimeOffset? publishedDate = default;
 064            DateTimeOffset? endOfLifeDate = default;
 065            StorageAccountType? storageAccountType = default;
 066            foreach (var property in element.EnumerateObject())
 67            {
 068                if (property.NameEquals("targetRegions"))
 69                {
 070                    if (property.Value.ValueKind == JsonValueKind.Null)
 71                    {
 72                        continue;
 73                    }
 074                    List<TargetRegion> array = new List<TargetRegion>();
 075                    foreach (var item in property.Value.EnumerateArray())
 76                    {
 077                        if (item.ValueKind == JsonValueKind.Null)
 78                        {
 079                            array.Add(null);
 80                        }
 81                        else
 82                        {
 083                            array.Add(TargetRegion.DeserializeTargetRegion(item));
 84                        }
 85                    }
 086                    targetRegions = array;
 087                    continue;
 88                }
 089                if (property.NameEquals("replicaCount"))
 90                {
 091                    if (property.Value.ValueKind == JsonValueKind.Null)
 92                    {
 93                        continue;
 94                    }
 095                    replicaCount = property.Value.GetInt32();
 096                    continue;
 97                }
 098                if (property.NameEquals("excludeFromLatest"))
 99                {
 0100                    if (property.Value.ValueKind == JsonValueKind.Null)
 101                    {
 102                        continue;
 103                    }
 0104                    excludeFromLatest = property.Value.GetBoolean();
 0105                    continue;
 106                }
 0107                if (property.NameEquals("publishedDate"))
 108                {
 0109                    if (property.Value.ValueKind == JsonValueKind.Null)
 110                    {
 111                        continue;
 112                    }
 0113                    publishedDate = property.Value.GetDateTimeOffset("O");
 0114                    continue;
 115                }
 0116                if (property.NameEquals("endOfLifeDate"))
 117                {
 0118                    if (property.Value.ValueKind == JsonValueKind.Null)
 119                    {
 120                        continue;
 121                    }
 0122                    endOfLifeDate = property.Value.GetDateTimeOffset("O");
 0123                    continue;
 124                }
 0125                if (property.NameEquals("storageAccountType"))
 126                {
 0127                    if (property.Value.ValueKind == JsonValueKind.Null)
 128                    {
 129                        continue;
 130                    }
 0131                    storageAccountType = new StorageAccountType(property.Value.GetString());
 132                    continue;
 133                }
 134            }
 0135            return new GalleryImageVersionPublishingProfile(targetRegions, replicaCount, excludeFromLatest, publishedDat
 136        }
 137    }
 138}