示例#1
0
        HostingEnvironmentWorkerPool IOperationSource <HostingEnvironmentWorkerPool> .CreateResult(Response response, CancellationToken cancellationToken)
        {
            using var document = JsonDocument.Parse(response.ContentStream);
            var data = WorkerPoolResourceData.DeserializeWorkerPoolResourceData(document.RootElement);

            return(new HostingEnvironmentWorkerPool(_armClient, data));
        }
示例#2
0
        internal static WorkerPoolCollection DeserializeWorkerPoolCollection(JsonElement element)
        {
            IReadOnlyList <WorkerPoolResourceData> value = default;
            Optional <string> nextLink = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("value"))
                {
                    List <WorkerPoolResourceData> array = new List <WorkerPoolResourceData>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(WorkerPoolResourceData.DeserializeWorkerPoolResourceData(item));
                    }
                    value = array;
                    continue;
                }
                if (property.NameEquals("nextLink"))
                {
                    nextLink = property.Value.GetString();
                    continue;
                }
            }
            return(new WorkerPoolCollection(value, nextLink.Value));
        }