Example #1
0
        internal static MLFlowModelJobOutput DeserializeMLFlowModelJobOutput(JsonElement element)
        {
            Optional <OutputDeliveryMode> mode = default;
            Optional <Uri>    uri           = default;
            Optional <string> description   = default;
            JobOutputType     jobOutputType = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("mode"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    mode = new OutputDeliveryMode(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("uri"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        uri = null;
                        continue;
                    }
                    uri = new Uri(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("jobOutputType"))
                {
                    jobOutputType = new JobOutputType(property.Value.GetString());
                    continue;
                }
            }
            return(new MLFlowModelJobOutput(description.Value, jobOutputType, Optional.ToNullable(mode), uri.Value));
        }
Example #2
0
 void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 {
     writer.WriteStartObject();
     if (Optional.IsDefined(Description))
     {
         if (Description != null)
         {
             writer.WritePropertyName("description");
             writer.WriteStringValue(Description);
         }
         else
         {
             writer.WriteNull("description");
         }
     }
     writer.WritePropertyName("jobOutputType");
     writer.WriteStringValue(JobOutputType.ToString());
     writer.WriteEndObject();
 }
Example #3
0
        internal static JobOutput DeserializeJobOutput(JsonElement element)
        {
            if (element.TryGetProperty("jobOutputType", out JsonElement discriminator))
            {
                switch (discriminator.GetString())
                {
                case "CustomModel": return(CustomModelJobOutput.DeserializeCustomModelJobOutput(element));

                case "MLFlowModel": return(MLFlowModelJobOutput.DeserializeMLFlowModelJobOutput(element));

                case "MLTable": return(MLTableJobOutput.DeserializeMLTableJobOutput(element));

                case "TritonModel": return(TritonModelJobOutput.DeserializeTritonModelJobOutput(element));

                case "UriFile": return(UriFileJobOutput.DeserializeUriFileJobOutput(element));

                case "UriFolder": return(UriFolderJobOutput.DeserializeUriFolderJobOutput(element));
                }
            }
            Optional <string> description   = default;
            JobOutputType     jobOutputType = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("description"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        description = null;
                        continue;
                    }
                    description = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("jobOutputType"))
                {
                    jobOutputType = new JobOutputType(property.Value.GetString());
                    continue;
                }
            }
            return(new JobOutput(description.Value, jobOutputType));
        }
Example #4
0
 internal UriFolderJobOutput(string description, JobOutputType jobOutputType, OutputDeliveryMode?mode, Uri uri) : base(description, jobOutputType)
 {
     Mode          = mode;
     Uri           = uri;
     JobOutputType = jobOutputType;
 }