コード例 #1
0
        internal static JobExecutionListResult DeserializeJobExecutionListResult(JsonElement element)
        {
            Optional <IReadOnlyList <JobExecutionData> > value = default;
            Optional <string> nextLink = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("value"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <JobExecutionData> array = new List <JobExecutionData>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(JobExecutionData.DeserializeJobExecutionData(item));
                    }
                    value = array;
                    continue;
                }
                if (property.NameEquals("nextLink"))
                {
                    nextLink = property.Value.GetString();
                    continue;
                }
            }
            return(new JobExecutionListResult(Optional.ToList(value), nextLink.Value));
        }
        ServerJobAgentJobExecution IOperationSource <ServerJobAgentJobExecution> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = JobExecutionData.DeserializeJobExecutionData(document.RootElement);

            return(new ServerJobAgentJobExecution(_armClient, data));
        }