Пример #1
0
 internal TrialComponent(CodeConfiguration codeConfiguration, string environmentId, IDictionary <string, DataBinding> dataBindings, DistributionConfiguration distributionConfiguration)
 {
     CodeConfiguration         = codeConfiguration;
     EnvironmentId             = environmentId;
     DataBindings              = dataBindings;
     DistributionConfiguration = distributionConfiguration;
 }
Пример #2
0
 internal CommandJob(JobType jobType, JobBaseInteractionEndpoints interactionEndpoints, string description, IDictionary <string, string> tags, IDictionary <string, string> properties, string experimentName, ComputeBinding computeBinding, JobOutput output, JobStatus?status, long?maxRunDurationSeconds, CodeConfiguration codeConfiguration, string environmentId, IDictionary <string, DataBinding> dataBindings, DistributionConfiguration distributionConfiguration) : base(jobType, interactionEndpoints, description, tags, properties, experimentName, computeBinding, output)
 {
     Status = status;
     MaxRunDurationSeconds     = maxRunDurationSeconds;
     CodeConfiguration         = codeConfiguration;
     EnvironmentId             = environmentId;
     DataBindings              = dataBindings;
     DistributionConfiguration = distributionConfiguration;
     JobType = jobType;
 }
        internal static TrialComponent DeserializeTrialComponent(JsonElement element)
        {
            Optional <CodeConfiguration> codeConfiguration             = default;
            Optional <string>            environmentId                 = default;
            Optional <IDictionary <string, DataBinding> > dataBindings = default;
            Optional <DistributionConfiguration>          distributionConfiguration = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("codeConfiguration"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    codeConfiguration = CodeConfiguration.DeserializeCodeConfiguration(property.Value);
                    continue;
                }
                if (property.NameEquals("environmentId"))
                {
                    environmentId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("dataBindings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    Dictionary <string, DataBinding> dictionary = new Dictionary <string, DataBinding>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, DataBinding.DeserializeDataBinding(property0.Value));
                    }
                    dataBindings = dictionary;
                    continue;
                }
                if (property.NameEquals("distributionConfiguration"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    distributionConfiguration = DistributionConfiguration.DeserializeDistributionConfiguration(property.Value);
                    continue;
                }
            }
            return(new TrialComponent(codeConfiguration.Value, environmentId.Value, Optional.ToDictionary(dataBindings), distributionConfiguration.Value));
        }
        internal static CommandJob DeserializeCommandJob(JsonElement element)
        {
            Optional <JobStatus> status = default;
            Optional <long>      maxRunDurationSeconds = default;
            CodeConfiguration    codeConfiguration     = default;
            Optional <string>    environmentId         = default;
            Optional <IDictionary <string, DataBinding> > dataBindings = default;
            Optional <DistributionConfiguration>          distributionConfiguration = default;
            Optional <string>    experimentName = default;
            ComputeBinding       computeBinding = default;
            Optional <JobOutput> output         = default;
            JobType jobType = default;
            Optional <JobBaseInteractionEndpoints> interactionEndpoints = default;
            Optional <string> description = default;
            Optional <IDictionary <string, string> > tags       = default;
            Optional <IDictionary <string, string> > properties = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("status"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    status = new JobStatus(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("maxRunDurationSeconds"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    maxRunDurationSeconds = property.Value.GetInt64();
                    continue;
                }
                if (property.NameEquals("codeConfiguration"))
                {
                    codeConfiguration = CodeConfiguration.DeserializeCodeConfiguration(property.Value);
                    continue;
                }
                if (property.NameEquals("environmentId"))
                {
                    environmentId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("dataBindings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    Dictionary <string, DataBinding> dictionary = new Dictionary <string, DataBinding>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, DataBinding.DeserializeDataBinding(property0.Value));
                    }
                    dataBindings = dictionary;
                    continue;
                }
                if (property.NameEquals("distributionConfiguration"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    distributionConfiguration = DistributionConfiguration.DeserializeDistributionConfiguration(property.Value);
                    continue;
                }
                if (property.NameEquals("experimentName"))
                {
                    experimentName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("computeBinding"))
                {
                    computeBinding = ComputeBinding.DeserializeComputeBinding(property.Value);
                    continue;
                }
                if (property.NameEquals("output"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    output = JobOutput.DeserializeJobOutput(property.Value);
                    continue;
                }
                if (property.NameEquals("jobType"))
                {
                    jobType = new JobType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("interactionEndpoints"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    interactionEndpoints = JobBaseInteractionEndpoints.DeserializeJobBaseInteractionEndpoints(property.Value);
                    continue;
                }
                if (property.NameEquals("description"))
                {
                    description = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    properties = dictionary;
                    continue;
                }
            }
            return(new CommandJob(jobType, interactionEndpoints.Value, description.Value, Optional.ToDictionary(tags), Optional.ToDictionary(properties), experimentName.Value, computeBinding, output.Value, Optional.ToNullable(status), Optional.ToNullable(maxRunDurationSeconds), codeConfiguration, environmentId.Value, Optional.ToDictionary(dataBindings), distributionConfiguration.Value));
        }