< Summary

Class:Azure.ResourceManager.DigitalTwins.Models.EventGrid
Assembly:Azure.ResourceManager.DigitalTwins
File(s):C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.ResourceManager.DigitalTwins\src\Generated\Models\EventGrid.cs
C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.ResourceManager.DigitalTwins\src\Generated\Models\EventGrid.Serialization.cs
Covered lines:0
Uncovered lines:69
Coverable lines:69
Total lines:159
Line coverage:0% (0 of 69)
Covered branches:0
Total branches:28
Branch coverage:0% (0 of 28)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-0%100%
get_TopicEndpoint()-0%100%
get_AccessKey1()-0%100%
get_AccessKey2()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeEventGrid(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.ResourceManager.DigitalTwins\src\Generated\Models\EventGrid.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.DigitalTwins.Models
 12{
 13    /// <summary> properties related to eventgrid. </summary>
 14    public partial class EventGrid : DigitalTwinsEndpointResourceProperties
 15    {
 16        /// <summary> Initializes a new instance of EventGrid. </summary>
 17        /// <param name="accessKey1"> EventGrid secondary accesskey. Will be obfuscated during read. </param>
 18        /// <param name="accessKey2"> EventGrid secondary accesskey. Will be obfuscated during read. </param>
 19        /// <exception cref="ArgumentNullException"> <paramref name="accessKey1"/> or <paramref name="accessKey2"/> is n
 020        public EventGrid(string accessKey1, string accessKey2)
 21        {
 022            if (accessKey1 == null)
 23            {
 024                throw new ArgumentNullException(nameof(accessKey1));
 25            }
 026            if (accessKey2 == null)
 27            {
 028                throw new ArgumentNullException(nameof(accessKey2));
 29            }
 30
 031            AccessKey1 = accessKey1;
 032            AccessKey2 = accessKey2;
 033            EndpointType = EndpointType.EventGrid;
 034        }
 35
 36        /// <summary> Initializes a new instance of EventGrid. </summary>
 37        /// <param name="endpointType"> The type of Digital Twins endpoint. </param>
 38        /// <param name="provisioningState"> The provisioning state. </param>
 39        /// <param name="createdTime"> Time when the Endpoint was added to DigitalTwinsInstance. </param>
 40        /// <param name="tags"> The resource tags. </param>
 41        /// <param name="topicEndpoint"> EventGrid Topic Endpoint. </param>
 42        /// <param name="accessKey1"> EventGrid secondary accesskey. Will be obfuscated during read. </param>
 43        /// <param name="accessKey2"> EventGrid secondary accesskey. Will be obfuscated during read. </param>
 044        internal EventGrid(EndpointType endpointType, EndpointProvisioningState? provisioningState, DateTimeOffset? crea
 45        {
 046            TopicEndpoint = topicEndpoint;
 047            AccessKey1 = accessKey1;
 048            AccessKey2 = accessKey2;
 049            EndpointType = endpointType;
 050        }
 51
 52        /// <summary> EventGrid Topic Endpoint. </summary>
 053        public string TopicEndpoint { get; set; }
 54        /// <summary> EventGrid secondary accesskey. Will be obfuscated during read. </summary>
 055        public string AccessKey1 { get; set; }
 56        /// <summary> EventGrid secondary accesskey. Will be obfuscated during read. </summary>
 057        public string AccessKey2 { get; set; }
 58    }
 59}

C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.ResourceManager.DigitalTwins\src\Generated\Models\EventGrid.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.DigitalTwins.Models
 14{
 15    public partial class EventGrid : IUtf8JsonSerializable
 16    {
 17        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 18        {
 019            writer.WriteStartObject();
 020            if (Optional.IsDefined(TopicEndpoint))
 21            {
 022                writer.WritePropertyName("TopicEndpoint");
 023                writer.WriteStringValue(TopicEndpoint);
 24            }
 025            writer.WritePropertyName("accessKey1");
 026            writer.WriteStringValue(AccessKey1);
 027            writer.WritePropertyName("accessKey2");
 028            writer.WriteStringValue(AccessKey2);
 029            writer.WritePropertyName("endpointType");
 030            writer.WriteStringValue(EndpointType.ToString());
 031            if (Optional.IsCollectionDefined(Tags))
 32            {
 033                writer.WritePropertyName("tags");
 034                writer.WriteStartObject();
 035                foreach (var item in Tags)
 36                {
 037                    writer.WritePropertyName(item.Key);
 038                    writer.WriteStringValue(item.Value);
 39                }
 040                writer.WriteEndObject();
 41            }
 042            writer.WriteEndObject();
 043        }
 44
 45        internal static EventGrid DeserializeEventGrid(JsonElement element)
 46        {
 047            Optional<string> topicEndpoint = default;
 048            string accessKey1 = default;
 049            string accessKey2 = default;
 050            EndpointType endpointType = default;
 051            Optional<EndpointProvisioningState> provisioningState = default;
 052            Optional<DateTimeOffset> createdTime = default;
 053            Optional<IDictionary<string, string>> tags = default;
 054            foreach (var property in element.EnumerateObject())
 55            {
 056                if (property.NameEquals("TopicEndpoint"))
 57                {
 058                    topicEndpoint = property.Value.GetString();
 059                    continue;
 60                }
 061                if (property.NameEquals("accessKey1"))
 62                {
 063                    accessKey1 = property.Value.GetString();
 064                    continue;
 65                }
 066                if (property.NameEquals("accessKey2"))
 67                {
 068                    accessKey2 = property.Value.GetString();
 069                    continue;
 70                }
 071                if (property.NameEquals("endpointType"))
 72                {
 073                    endpointType = new EndpointType(property.Value.GetString());
 074                    continue;
 75                }
 076                if (property.NameEquals("provisioningState"))
 77                {
 078                    provisioningState = new EndpointProvisioningState(property.Value.GetString());
 079                    continue;
 80                }
 081                if (property.NameEquals("createdTime"))
 82                {
 083                    createdTime = property.Value.GetDateTimeOffset("O");
 084                    continue;
 85                }
 086                if (property.NameEquals("tags"))
 87                {
 088                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 089                    foreach (var property0 in property.Value.EnumerateObject())
 90                    {
 091                        dictionary.Add(property0.Name, property0.Value.GetString());
 92                    }
 093                    tags = dictionary;
 94                    continue;
 95                }
 96            }
 097            return new EventGrid(endpointType, Optional.ToNullable(provisioningState), Optional.ToNullable(createdTime),
 98        }
 99    }
 100}