Ejemplo n.º 1
0
        /// <summary>
        /// Gets a list of all zones in the specified compartment. The collection can be filtered by name, time created, and zone type.
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <ListZonesResponse> ListZones(ListZonesRequest request)
        {
            var uri = new Uri($"{GetEndPoint(DNSServices.Zones, this.Region)}?{request.GetOptionQuery()}");

            using (var webResponse = await this.RestClientAsync.Get(uri))
                using (var stream = webResponse.GetResponseStream())
                    using (var reader = new StreamReader(stream))
                    {
                        var response = await reader.ReadToEndAsync();

                        return(new ListZonesResponse()
                        {
                            Items = this.JsonSerializer.Deserialize <List <ZoneSummary> >(response),
                            OpcRequestId = webResponse.Headers.Get("opc-request-id"),
                            OpcTotalItems = webResponse.Headers.Get("opc-total-items"),
                            OpcNextPage = webResponse.Headers.Get("opc-next-page")
                        });
                    }
        }