Example #1
0
 internal ExpressRouteConnection(string id, string name, ProvisioningState?provisioningState, ExpressRouteCircuitPeeringId expressRouteCircuitPeering, string authorizationKey, int?routingWeight, bool?enableInternetSecurity, RoutingConfiguration routingConfiguration) : base(id)
 {
     Name = name;
     ProvisioningState          = provisioningState;
     ExpressRouteCircuitPeering = expressRouteCircuitPeering;
     AuthorizationKey           = authorizationKey;
     RoutingWeight          = routingWeight;
     EnableInternetSecurity = enableInternetSecurity;
     RoutingConfiguration   = routingConfiguration;
 }
        internal static ExpressRouteConnection DeserializeExpressRouteConnection(JsonElement element)
        {
            string                                  name = default;
            Optional <string>                       id   = default;
            Optional <ProvisioningState>            provisioningState          = default;
            Optional <ExpressRouteCircuitPeeringId> expressRouteCircuitPeering = default;
            Optional <string>                       authorizationKey           = default;
            Optional <int>                          routingWeight          = default;
            Optional <bool>                         enableInternetSecurity = default;
            Optional <RoutingConfiguration>         routingConfiguration   = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("provisioningState"))
                        {
                            provisioningState = new ProvisioningState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("expressRouteCircuitPeering"))
                        {
                            expressRouteCircuitPeering = ExpressRouteCircuitPeeringId.DeserializeExpressRouteCircuitPeeringId(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("authorizationKey"))
                        {
                            authorizationKey = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("routingWeight"))
                        {
                            routingWeight = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("enableInternetSecurity"))
                        {
                            enableInternetSecurity = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("routingConfiguration"))
                        {
                            routingConfiguration = RoutingConfiguration.DeserializeRoutingConfiguration(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ExpressRouteConnection(id.Value, name, Optional.ToNullable(provisioningState), expressRouteCircuitPeering.Value, authorizationKey.Value, Optional.ToNullable(routingWeight), Optional.ToNullable(enableInternetSecurity), routingConfiguration.Value));
        }
        internal static ExpressRouteConnection DeserializeExpressRouteConnection(JsonElement element)
        {
            string                       name = default;
            string                       id   = default;
            ProvisioningState?           provisioningState          = default;
            ExpressRouteCircuitPeeringId expressRouteCircuitPeering = default;
            string                       authorizationKey           = default;
            int? routingWeight          = default;
            bool?enableInternetSecurity = default;
            RoutingConfiguration routingConfiguration = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            provisioningState = new ProvisioningState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("expressRouteCircuitPeering"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            expressRouteCircuitPeering = ExpressRouteCircuitPeeringId.DeserializeExpressRouteCircuitPeeringId(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("authorizationKey"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            authorizationKey = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("routingWeight"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            routingWeight = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("enableInternetSecurity"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            enableInternetSecurity = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("routingConfiguration"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            routingConfiguration = RoutingConfiguration.DeserializeRoutingConfiguration(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ExpressRouteConnection(id, name, provisioningState, expressRouteCircuitPeering, authorizationKey, routingWeight, enableInternetSecurity, routingConfiguration));
        }