예제 #1
0
        /// <summary>
        /// List the start times of the available aggregated profiles of a profiling group for an aggregation period within the specified time range.
        /// ListProfileTimes /profilingGroups/{profilingGroupName}/profileTimes#endTime&period&startTime
        /// </summary>
        /// <param name="endTime">The end time of the time range from which to list the profiles.</param>
        /// <param name="maxResults">The maximum number of profile time results returned by <code>ListProfileTimes</code> in paginated output. When this parameter is used, <code>ListProfileTimes</code> only returns <code>maxResults</code> results in a single page with a <code>nextToken</code> response element. The remaining results of the initial request can be seen by sending another <code>ListProfileTimes</code> request with the returned <code>nextToken</code> value. </param>
        /// <param name="nextToken"><p>The <code>nextToken</code> value returned from a previous paginated <code>ListProfileTimes</code> request where <code>maxResults</code> was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the <code>nextToken</code> value. </p> <note> <p>This token should be treated as an opaque identifier that is only used to retrieve the next items in a list and not for other programmatic purposes.</p> </note></param>
        /// <param name="orderBy">The order (ascending or descending by start time of the profile) to use when listing profiles. Defaults to <code>TIMESTAMP_DESCENDING</code>. </param>
        /// <param name="period">The aggregation period.</param>
        /// <param name="profilingGroupName">The name of the profiling group.</param>
        /// <param name="startTime">The start time of the time range from which to list the profiles.</param>
        /// <returns>Success</returns>
        public async Task <ListProfileTimesResponse> ListProfileTimesAsync(System.DateTimeOffset endTime, int maxResults, string nextToken, OrderBy orderBy, AggregationPeriod period, string profilingGroupName, System.DateTimeOffset startTime, Action <System.Net.Http.Headers.HttpRequestHeaders> handleHeaders = null)
        {
            var requestUri = "/profilingGroups/" + (profilingGroupName == null? "" : Uri.EscapeDataString(profilingGroupName)) + "/profileTimes#endTime&period&startTime?endTime=" + endTime.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ") + "&maxResults=" + maxResults + "&nextToken=" + (nextToken == null? "" : Uri.EscapeDataString(nextToken)) + "&orderBy=" + orderBy + "&period=" + period + "&startTime=" + startTime.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ");

            using (var request = new HttpRequestMessage(HttpMethod.Get, requestUri))
            {
                if (handleHeaders != null)
                {
                    handleHeaders(request.Headers);
                }

                var responseMessage = await client.SendAsync(request);

                try
                {
                    responseMessage.EnsureSuccessStatusCodeEx();
                    var stream = await responseMessage.Content.ReadAsStreamAsync();

                    using (JsonReader jsonReader = new JsonTextReader(new System.IO.StreamReader(stream)))
                    {
                        var serializer = new JsonSerializer();
                        return(serializer.Deserialize <ListProfileTimesResponse>(jsonReader));
                    }
                }
                finally
                {
                    responseMessage.Dispose();
                }
            }
        }
 public static string ToIsoString(this DateTimeOffset value)
 {
     return(value.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss\\Z", DateTimeFormatInfo.InvariantInfo));
 }