Пример #1
0
        internal static BatchEndpointProperties DeserializeBatchEndpointProperties(JsonElement element)
        {
            Optional <BatchEndpointDefaults>     defaults          = default;
            Optional <EndpointProvisioningState> provisioningState = default;
            EndpointAuthMode            authMode                = default;
            Optional <string>           description             = default;
            Optional <EndpointAuthKeys> keys                    = default;
            Optional <IDictionary <string, string> > properties = default;
            Optional <Uri> scoringUri = default;
            Optional <Uri> swaggerUri = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("defaults"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        defaults = null;
                        continue;
                    }
                    defaults = BatchEndpointDefaults.DeserializeBatchEndpointDefaults(property.Value);
                    continue;
                }
                if (property.NameEquals("provisioningState"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    provisioningState = new EndpointProvisioningState(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("authMode"))
                {
                    authMode = new EndpointAuthMode(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("description"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        description = null;
                        continue;
                    }
                    description = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("keys"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        keys = null;
                        continue;
                    }
                    keys = EndpointAuthKeys.DeserializeEndpointAuthKeys(property.Value);
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        properties = null;
                        continue;
                    }
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.Value.ValueKind == JsonValueKind.Null)
                        {
                            dictionary.Add(property0.Name, null);
                        }
                        else
                        {
                            dictionary.Add(property0.Name, property0.Value.GetString());
                        }
                    }
                    properties = dictionary;
                    continue;
                }
                if (property.NameEquals("scoringUri"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        scoringUri = null;
                        continue;
                    }
                    scoringUri = new Uri(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("swaggerUri"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        swaggerUri = null;
                        continue;
                    }
                    swaggerUri = new Uri(property.Value.GetString());
                    continue;
                }
            }
            return(new BatchEndpointProperties(authMode, description.Value, keys.Value, Optional.ToDictionary(properties), scoringUri.Value, swaggerUri.Value, defaults.Value, Optional.ToNullable(provisioningState)));
        }
Пример #2
0
 internal BatchEndpointProperties(EndpointAuthMode authMode, string description, EndpointAuthKeys keys, IDictionary <string, string> properties, Uri scoringUri, Uri swaggerUri, BatchEndpointDefaults defaults, EndpointProvisioningState?provisioningState) : base(authMode, description, keys, properties, scoringUri, swaggerUri)
 {
     Defaults          = defaults;
     ProvisioningState = provisioningState;
 }