internal ConnectionMonitorEndpoint(string name, string resourceId, string address, ConnectionMonitorEndpointFilter filter)
 {
     Name       = name;
     ResourceId = resourceId;
     Address    = address;
     Filter     = filter;
 }
        internal static ConnectionMonitorEndpoint DeserializeConnectionMonitorEndpoint(JsonElement element)
        {
            string            name       = default;
            Optional <string> resourceId = default;
            Optional <string> address    = default;
            Optional <ConnectionMonitorEndpointFilter> filter = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("resourceId"))
                {
                    resourceId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("address"))
                {
                    address = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("filter"))
                {
                    filter = ConnectionMonitorEndpointFilter.DeserializeConnectionMonitorEndpointFilter(property.Value);
                    continue;
                }
            }
            return(new ConnectionMonitorEndpoint(name, resourceId.Value, address.Value, filter.Value));
        }
Example #3
0
 internal ConnectionMonitorEndpoint(string name, EndpointType?endpointType, ResourceIdentifier resourceId, string address, ConnectionMonitorEndpointFilter filter, ConnectionMonitorEndpointScope scope, CoverageLevel?coverageLevel)
 {
     Name          = name;
     EndpointType  = endpointType;
     ResourceId    = resourceId;
     Address       = address;
     Filter        = filter;
     Scope         = scope;
     CoverageLevel = coverageLevel;
 }
Example #4
0
        internal static ConnectionMonitorEndpoint DeserializeConnectionMonitorEndpoint(JsonElement element)
        {
            string name       = default;
            string resourceId = default;
            string address    = default;
            ConnectionMonitorEndpointFilter filter = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("resourceId"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    resourceId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("address"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    address = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("filter"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    filter = ConnectionMonitorEndpointFilter.DeserializeConnectionMonitorEndpointFilter(property.Value);
                    continue;
                }
            }
            return(new ConnectionMonitorEndpoint(name, resourceId, address, filter));
        }
        internal static ConnectionMonitorEndpoint DeserializeConnectionMonitorEndpoint(JsonElement element)
        {
            string name = default;
            Optional <EndpointType> type       = default;
            Optional <string>       resourceId = default;
            Optional <string>       address    = default;
            Optional <ConnectionMonitorEndpointFilter> filter = default;
            Optional <ConnectionMonitorEndpointScope>  scope  = default;
            Optional <CoverageLevel> coverageLevel            = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    type = new EndpointType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("resourceId"))
                {
                    resourceId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("address"))
                {
                    address = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("filter"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    filter = ConnectionMonitorEndpointFilter.DeserializeConnectionMonitorEndpointFilter(property.Value);
                    continue;
                }
                if (property.NameEquals("scope"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    scope = ConnectionMonitorEndpointScope.DeserializeConnectionMonitorEndpointScope(property.Value);
                    continue;
                }
                if (property.NameEquals("coverageLevel"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    coverageLevel = new CoverageLevel(property.Value.GetString());
                    continue;
                }
            }
            return(new ConnectionMonitorEndpoint(name, Optional.ToNullable(type), resourceId.Value, address.Value, filter.Value, scope.Value, Optional.ToNullable(coverageLevel)));
        }