コード例 #1
0
 internal JobDetails(string id, string name, string containerUri, string inputDataUri, string inputDataFormat, object inputParams, string providerId, string target, IDictionary <string, string> metadata, string outputDataUri, string outputDataFormat, JobStatus?status, DateTimeOffset?creationTime, DateTimeOffset?beginExecutionTime, DateTimeOffset?endExecutionTime, DateTimeOffset?cancellationTime, CostEstimate costEstimate, ErrorData errorData, IList <string> tags)
 {
     Id                 = id;
     Name               = name;
     ContainerUri       = containerUri;
     InputDataUri       = inputDataUri;
     InputDataFormat    = inputDataFormat;
     InputParams        = inputParams;
     ProviderId         = providerId;
     Target             = target;
     Metadata           = metadata;
     OutputDataUri      = outputDataUri;
     OutputDataFormat   = outputDataFormat;
     Status             = status;
     CreationTime       = creationTime;
     BeginExecutionTime = beginExecutionTime;
     EndExecutionTime   = endExecutionTime;
     CancellationTime   = cancellationTime;
     CostEstimate       = costEstimate;
     ErrorData          = errorData;
     Tags               = tags;
 }
コード例 #2
0
        public static JobDetails JobDetails(string id = null, string name = null, string containerUri = null, string inputDataUri = null, string inputDataFormat = null, object inputParams = null, string providerId = null, string target = null, IDictionary <string, string> metadata = null, string outputDataUri = null, string outputDataFormat = null, JobStatus?status = null, DateTimeOffset?creationTime = null, DateTimeOffset?beginExecutionTime = null, DateTimeOffset?endExecutionTime = null, DateTimeOffset?cancellationTime = null, CostEstimate costEstimate = null, ErrorData errorData = null, IEnumerable <string> tags = null)
        {
            metadata ??= new Dictionary <string, string>();
            tags ??= new List <string>();

            return(new JobDetails(id, name, containerUri, inputDataUri, inputDataFormat, inputParams, providerId, target, metadata, outputDataUri, outputDataFormat, status, creationTime, beginExecutionTime, endExecutionTime, cancellationTime, costEstimate, errorData, tags?.ToList()));
        }
コード例 #3
0
        internal static JobDetails DeserializeJobDetails(JsonElement element)
        {
            Optional <string> id              = default;
            Optional <string> name            = default;
            string            containerUri    = default;
            Optional <string> inputDataUri    = default;
            string            inputDataFormat = default;
            Optional <object> inputParams     = default;
            string            providerId      = default;
            string            target          = default;
            Optional <IDictionary <string, string> > metadata = default;
            Optional <string>          outputDataUri          = default;
            Optional <string>          outputDataFormat       = default;
            Optional <JobStatus>       status             = default;
            Optional <DateTimeOffset>  creationTime       = default;
            Optional <DateTimeOffset?> beginExecutionTime = default;
            Optional <DateTimeOffset?> endExecutionTime   = default;
            Optional <DateTimeOffset?> cancellationTime   = default;
            Optional <CostEstimate>    costEstimate       = default;
            Optional <ErrorData>       errorData          = default;
            Optional <IList <string> > tags = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("containerUri"))
                {
                    containerUri = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("inputDataUri"))
                {
                    inputDataUri = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("inputDataFormat"))
                {
                    inputDataFormat = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("inputParams"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    inputParams = property.Value.GetObject();
                    continue;
                }
                if (property.NameEquals("providerId"))
                {
                    providerId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("target"))
                {
                    target = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("metadata"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        metadata = null;
                        continue;
                    }
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    metadata = dictionary;
                    continue;
                }
                if (property.NameEquals("outputDataUri"))
                {
                    outputDataUri = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("outputDataFormat"))
                {
                    outputDataFormat = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("status"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    status = new JobStatus(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("creationTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    creationTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("beginExecutionTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        beginExecutionTime = null;
                        continue;
                    }
                    beginExecutionTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("endExecutionTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        endExecutionTime = null;
                        continue;
                    }
                    endExecutionTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("cancellationTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        cancellationTime = null;
                        continue;
                    }
                    cancellationTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("costEstimate"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        costEstimate = null;
                        continue;
                    }
                    costEstimate = CostEstimate.DeserializeCostEstimate(property.Value);
                    continue;
                }
                if (property.NameEquals("errorData"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        errorData = null;
                        continue;
                    }
                    errorData = ErrorData.DeserializeErrorData(property.Value);
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        tags = null;
                        continue;
                    }
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetString());
                    }
                    tags = array;
                    continue;
                }
            }
            return(new JobDetails(id.Value, name.Value, containerUri, inputDataUri.Value, inputDataFormat, inputParams.Value, providerId, target, Optional.ToDictionary(metadata), outputDataUri.Value, outputDataFormat.Value, Optional.ToNullable(status), Optional.ToNullable(creationTime), Optional.ToNullable(beginExecutionTime), Optional.ToNullable(endExecutionTime), Optional.ToNullable(cancellationTime), costEstimate.Value, errorData.Value, Optional.ToList(tags)));
        }