Beispiel #1
0
        internal static WebPubSubNetworkAcls DeserializeWebPubSubNetworkAcls(JsonElement element)
        {
            Optional <AclAction>  defaultAction = default;
            Optional <NetworkAcl> publicNetwork = default;
            Optional <IList <PrivateEndpointAcl> > privateEndpoints = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("defaultAction"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    defaultAction = new AclAction(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("publicNetwork"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    publicNetwork = NetworkAcl.DeserializeNetworkAcl(property.Value);
                    continue;
                }
                if (property.NameEquals("privateEndpoints"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <PrivateEndpointAcl> array = new List <PrivateEndpointAcl>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(PrivateEndpointAcl.DeserializePrivateEndpointAcl(item));
                    }
                    privateEndpoints = array;
                    continue;
                }
            }
            return(new WebPubSubNetworkAcls(Optional.ToNullable(defaultAction), publicNetwork.Value, Optional.ToList(privateEndpoints)));
        }
 internal WebPubSubNetworkAcls(AclAction?defaultAction, NetworkAcl publicNetwork, IList <PrivateEndpointAcl> privateEndpoints)
 {
     DefaultAction    = defaultAction;
     PublicNetwork    = publicNetwork;
     PrivateEndpoints = privateEndpoints;
 }