コード例 #1
0
 internal NetworkFeaturesData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string kind, string virtualNetworkName, VnetInfo virtualNetworkConnection, IReadOnlyList <RelayServiceConnectionEntityData> hybridConnections, IReadOnlyList <HybridConnectionData> hybridConnectionsV2) : base(id, name, resourceType, systemData, kind)
 {
     VirtualNetworkName       = virtualNetworkName;
     VirtualNetworkConnection = virtualNetworkConnection;
     HybridConnections        = hybridConnections;
     HybridConnectionsV2      = hybridConnectionsV2;
 }
        internal static NetworkFeaturesData DeserializeNetworkFeaturesData(JsonElement element)
        {
            Optional <string>   kind = default;
            ResourceIdentifier  id   = default;
            string              name = default;
            ResourceType        type = default;
            Optional <string>   virtualNetworkName       = default;
            Optional <VnetInfo> virtualNetworkConnection = default;
            Optional <IReadOnlyList <RelayServiceConnectionEntityData> > hybridConnections   = default;
            Optional <IReadOnlyList <HybridConnectionData> >             hybridConnectionsV2 = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("kind"))
                {
                    kind = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("virtualNetworkName"))
                        {
                            virtualNetworkName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("virtualNetworkConnection"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            virtualNetworkConnection = VnetInfo.DeserializeVnetInfo(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("hybridConnections"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <RelayServiceConnectionEntityData> array = new List <RelayServiceConnectionEntityData>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(RelayServiceConnectionEntityData.DeserializeRelayServiceConnectionEntityData(item));
                            }
                            hybridConnections = array;
                            continue;
                        }
                        if (property0.NameEquals("hybridConnectionsV2"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <HybridConnectionData> array = new List <HybridConnectionData>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(HybridConnectionData.DeserializeHybridConnectionData(item));
                            }
                            hybridConnectionsV2 = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new NetworkFeaturesData(id, name, type, kind.Value, virtualNetworkName.Value, virtualNetworkConnection.Value, Optional.ToList(hybridConnections), Optional.ToList(hybridConnectionsV2)));
        }