internal ManagedPrivateEndpointProperties(string name, string privateLinkResourceId, string groupId, string provisioningState, ManagedPrivateEndpointConnectionState connectionState, bool?isReserved, IList <string> fqdns, bool?isCompliant)
 {
     Name = name;
     PrivateLinkResourceId = privateLinkResourceId;
     GroupId           = groupId;
     ProvisioningState = provisioningState;
     ConnectionState   = connectionState;
     IsReserved        = isReserved;
     Fqdns             = fqdns;
     IsCompliant       = isCompliant;
 }
        internal static ManagedPrivateEndpointProperties DeserializeManagedPrivateEndpointProperties(JsonElement element)
        {
            Optional <string> privateLinkResourceId = default;
            Optional <string> groupId           = default;
            Optional <string> provisioningState = default;
            Optional <ManagedPrivateEndpointConnectionState> connectionState = default;
            Optional <bool> isReserved = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("privateLinkResourceId"))
                {
                    privateLinkResourceId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("groupId"))
                {
                    groupId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("provisioningState"))
                {
                    provisioningState = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("connectionState"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    connectionState = ManagedPrivateEndpointConnectionState.DeserializeManagedPrivateEndpointConnectionState(property.Value);
                    continue;
                }
                if (property.NameEquals("isReserved"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    isReserved = property.Value.GetBoolean();
                    continue;
                }
            }
            return(new ManagedPrivateEndpointProperties(privateLinkResourceId.Value, groupId.Value, provisioningState.Value, connectionState.Value, Optional.ToNullable(isReserved)));
        }
        public static ManagedPrivateEndpointProperties ManagedPrivateEndpointProperties(string name = null, string privateLinkResourceId = null, string groupId = null, string provisioningState = null, ManagedPrivateEndpointConnectionState connectionState = null, bool?isReserved = null, IEnumerable <string> fqdns = null, bool?isCompliant = null)
        {
            fqdns ??= new List <string>();

            return(new ManagedPrivateEndpointProperties(name, privateLinkResourceId, groupId, provisioningState, connectionState, isReserved, fqdns?.ToList(), isCompliant));
        }
Exemple #4
0
        internal static ManagedPrivateEndpointProperties DeserializeManagedPrivateEndpointProperties(JsonElement element)
        {
            Optional <string> name = default;
            Optional <string> privateLinkResourceId = default;
            Optional <string> groupId           = default;
            Optional <string> provisioningState = default;
            Optional <ManagedPrivateEndpointConnectionState> connectionState = default;
            Optional <bool>            isReserved  = default;
            Optional <IList <string> > fqdns       = default;
            Optional <bool>            isCompliant = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("privateLinkResourceId"))
                {
                    privateLinkResourceId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("groupId"))
                {
                    groupId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("provisioningState"))
                {
                    provisioningState = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("connectionState"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    connectionState = ManagedPrivateEndpointConnectionState.DeserializeManagedPrivateEndpointConnectionState(property.Value);
                    continue;
                }
                if (property.NameEquals("isReserved"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    isReserved = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("fqdns"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetString());
                    }
                    fqdns = array;
                    continue;
                }
                if (property.NameEquals("isCompliant"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    isCompliant = property.Value.GetBoolean();
                    continue;
                }
            }
            return(new ManagedPrivateEndpointProperties(name.Value, privateLinkResourceId.Value, groupId.Value, provisioningState.Value, connectionState.Value, Optional.ToNullable(isReserved), Optional.ToList(fqdns), Optional.ToNullable(isCompliant)));
        }