Пример #1
0
        internal static ExpressRouteLink DeserializeExpressRouteLink(JsonElement element)
        {
            Optional <string> name          = default;
            Optional <string> etag          = default;
            Optional <string> id            = default;
            Optional <string> routerName    = default;
            Optional <string> interfaceName = default;
            Optional <string> patchPanelId  = default;
            Optional <string> rackId        = default;
            Optional <ExpressRouteLinkConnectorType> connectorType     = default;
            Optional <ExpressRouteLinkAdminState>    adminState        = default;
            Optional <ProvisioningState>             provisioningState = default;
            Optional <ExpressRouteLinkMacSecConfig>  macSecConfig      = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("etag"))
                {
                    etag = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = 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("routerName"))
                        {
                            routerName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("interfaceName"))
                        {
                            interfaceName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("patchPanelId"))
                        {
                            patchPanelId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("rackId"))
                        {
                            rackId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("connectorType"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            connectorType = new ExpressRouteLinkConnectorType(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("adminState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            adminState = new ExpressRouteLinkAdminState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningState = new ProvisioningState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("macSecConfig"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            macSecConfig = ExpressRouteLinkMacSecConfig.DeserializeExpressRouteLinkMacSecConfig(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ExpressRouteLink(id.Value, name.Value, etag.Value, routerName.Value, interfaceName.Value, patchPanelId.Value, rackId.Value, Optional.ToNullable(connectorType), Optional.ToNullable(adminState), Optional.ToNullable(provisioningState), macSecConfig.Value));
        }
Пример #2
0
        internal static ExpressRouteLink DeserializeExpressRouteLink(JsonElement element)
        {
            string name          = default;
            string etag          = default;
            string id            = default;
            string routerName    = default;
            string interfaceName = default;
            string patchPanelId  = default;
            string rackId        = default;
            ExpressRouteLinkConnectorType?connectorType     = default;
            ExpressRouteLinkAdminState?   adminState        = default;
            ProvisioningState?            provisioningState = default;
            ExpressRouteLinkMacSecConfig  macSecConfig      = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("etag"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    etag = 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("routerName"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            routerName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("interfaceName"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            interfaceName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("patchPanelId"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            patchPanelId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("rackId"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            rackId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("connectorType"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            connectorType = new ExpressRouteLinkConnectorType(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("adminState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            adminState = new ExpressRouteLinkAdminState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            provisioningState = new ProvisioningState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("macSecConfig"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            macSecConfig = ExpressRouteLinkMacSecConfig.DeserializeExpressRouteLinkMacSecConfig(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ExpressRouteLink(id, name, etag, routerName, interfaceName, patchPanelId, rackId, connectorType, adminState, provisioningState, macSecConfig));
        }