예제 #1
0
        /// <summary>
        /// Initiates the asynchronous execution of the GetMetricStatistics operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the GetMetricStatistics operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task <GetMetricStatisticsResponse> GetMetricStatisticsAsync(GetMetricStatisticsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new GetMetricStatisticsRequestMarshaller();
            var unmarshaller = GetMetricStatisticsResponseUnmarshaller.Instance;

            return(InvokeAsync <GetMetricStatisticsRequest, GetMetricStatisticsResponse>(request, marshaller,
                                                                                         unmarshaller, cancellationToken));
        }
        private static IDictionary <string, string> ConvertGetMetricStatistics(GetMetricStatisticsRequest request)
        {
            IDictionary <string, string> dictionary = new Dictionary <string, string>();

            dictionary["Action"] = "GetMetricStatistics";
            List <string> statistics = request.Statistics;
            int           num        = 1;

            foreach (string str in statistics)
            {
                dictionary["Statistics" + ".member." + num] = str;
                num++;
            }
            if (request.IsSetPeriod())
            {
                dictionary["Period"] = request.Period.ToString();
            }
            if (request.IsSetMeasureName())
            {
                dictionary["MeasureName"] = request.MeasureName;
            }
            List <Dimension> dimensions = request.Dimensions;
            int num2 = 1;

            foreach (Dimension dimension in dimensions)
            {
                if (dimension.IsSetName())
                {
                    dictionary[string.Concat(new object[] { "Dimensions", ".member.", num2, ".", "Name" })] = dimension.Name;
                }
                if (dimension.IsSetValue())
                {
                    dictionary[string.Concat(new object[] { "Dimensions", ".member.", num2, ".", "Value" })] = dimension.Value;
                }
                num2++;
            }
            if (request.IsSetStartTime())
            {
                dictionary["StartTime"] = request.StartTime;
            }
            if (request.IsSetEndTime())
            {
                dictionary["EndTime"] = request.EndTime;
            }
            if (request.IsSetUnit())
            {
                dictionary["Unit"] = request.Unit;
            }
            if (request.IsSetCustomUnit())
            {
                dictionary["CustomUnit"] = request.CustomUnit;
            }
            if (request.IsSetNamespace())
            {
                dictionary["Namespace"] = request.Namespace;
            }
            return(dictionary);
        }
예제 #3
0
        IAsyncResult invokeGetMetricStatistics(GetMetricStatisticsRequest getMetricStatisticsRequest, AsyncCallback callback, object state, bool synchronized)
        {
            IRequest    irequest     = new GetMetricStatisticsRequestMarshaller().Marshall(getMetricStatisticsRequest);
            var         unmarshaller = GetMetricStatisticsResponseUnmarshaller.GetInstance();
            AsyncResult result       = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);

            Invoke(result);
            return(result);
        }
예제 #4
0
        /// <summary>
        /// Initiates the asynchronous execution of the GetMetricStatistics operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the GetMetricStatistics operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/monitoring-2010-08-01/GetMetricStatistics">REST API Reference for GetMetricStatistics Operation</seealso>
        public virtual Task <GetMetricStatisticsResponse> GetMetricStatisticsAsync(GetMetricStatisticsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = GetMetricStatisticsRequestMarshaller.Instance;
            options.ResponseUnmarshaller = GetMetricStatisticsResponseUnmarshaller.Instance;

            return(InvokeAsync <GetMetricStatisticsResponse>(request, options, cancellationToken));
        }
예제 #5
0
        internal virtual GetMetricStatisticsResponse GetMetricStatistics(GetMetricStatisticsRequest request)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = GetMetricStatisticsRequestMarshaller.Instance;
            options.ResponseUnmarshaller = GetMetricStatisticsResponseUnmarshaller.Instance;

            return(Invoke <GetMetricStatisticsResponse>(request, options));
        }
예제 #6
0
        /*
         * public async Task DeleteAlarmsAsync() { }
         *
         * public async Task DescribeAlarmHistoryAsync() { }
         *
         * public async Task DescribeAlarmsAsync() { }
         *
         * public async Task DesribeAlarmsForMetricAsync() { }
         *
         * public async Task DisableAlarmActions() { }
         *
         * public async Task EnableAlarmActionsAsync() { }
         */

        public async Task <GetMetricStatatisticsResponse> GetMetricStatisticsAsync(GetMetricStatisticsRequest request)
        {
            var httpRequest = new HttpRequestMessage(HttpMethod.Post, Endpoint)
            {
                Content = GetPostContent(request.ToParams())
            };

            var responseText = await SendAsync(httpRequest).ConfigureAwait(false);

            return(GetMetricStatatisticsResponse.Parse(responseText));

            // return PutMetricDataResult.Parse(responseText);
        }
예제 #7
0
        internal GetMetricStatisticsResponse GetMetricStatistics(GetMetricStatisticsRequest request)
        {
            var task = GetMetricStatisticsAsync(request);

            try
            {
                return(task.Result);
            }
            catch (AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return(null);
            }
        }
예제 #8
0
 /// <summary>
 /// Initiates the asynchronous execution of the GetMetricStatistics operation.
 /// <seealso cref="Amazon.CloudWatch.AmazonCloudWatch.GetMetricStatistics"/>
 /// </summary>
 ///
 /// <param name="getMetricStatisticsRequest">Container for the necessary parameters to execute the GetMetricStatistics operation on
 ///          AmazonCloudWatch.</param>
 /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
 /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///          procedure using the AsyncState property.</param>
 ///
 /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking
 ///         EndGetMetricStatistics operation.</returns>
 public IAsyncResult BeginGetMetricStatistics(GetMetricStatisticsRequest getMetricStatisticsRequest, AsyncCallback callback, object state)
 {
     return(invokeGetMetricStatistics(getMetricStatisticsRequest, callback, state, false));
 }
예제 #9
0
        /// <summary>
        /// <para> Gets statistics for the specified metric. </para> <para><b>NOTE:</b> The maximum number of data points returned from a single
        /// GetMetricStatistics request is 1,440. If a request is made that generates more than 1,440 data points, Amazon CloudWatch returns an error.
        /// In such a case, alter the request by narrowing the specified time range or increasing the specified period. Alternatively, make multiple
        /// requests across adjacent time ranges. </para> <para> Amazon CloudWatch aggregates data points based on the length of the <c>period</c> that
        /// you specify. For example, if you request statistics with a one-minute granularity, Amazon CloudWatch aggregates data points with time stamps
        /// that fall within the same one-minute period. In such a case, the data points queried can greatly outnumber the data points returned. </para>
        /// <para><b>NOTE:</b> The maximum number of data points that can be queried is 50,850; whereas the maximum number of data points returned is
        /// 1,440. </para> <para> The following examples show various statistics allowed by the data point query maximum of 50,850 when you call
        /// <c>GetMetricStatistics</c> on Amazon EC2 instances with detailed (one-minute) monitoring enabled: </para>
        /// <ul>
        /// <li>Statistics for up to 400 instances for a span of one hour</li>
        /// <li>Statistics for up to 35 instances over a span of 24 hours</li>
        /// <li>Statistics for up to 2 instances over a span of 2 weeks</li>
        ///
        /// </ul>
        /// <para> For information about the namespace, metric names, and dimensions that other Amazon Web Services products use to send metrics to
        /// Cloudwatch, go to CloudWatch Support for AWS Products in the <i>Amazon CloudWatch Developer Guide</i> .
        /// </para>
        /// </summary>
        ///
        /// <param name="getMetricStatisticsRequest">Container for the necessary parameters to execute the GetMetricStatistics service method on
        ///          AmazonCloudWatch.</param>
        ///
        /// <returns>The response from the GetMetricStatistics service method, as returned by AmazonCloudWatch.</returns>
        ///
        /// <exception cref="InvalidParameterValueException"/>
        /// <exception cref="InternalServiceException"/>
        /// <exception cref="InvalidParameterCombinationException"/>
        /// <exception cref="MissingRequiredParameterException"/>
        public GetMetricStatisticsResponse GetMetricStatistics(GetMetricStatisticsRequest getMetricStatisticsRequest)
        {
            IAsyncResult asyncResult = invokeGetMetricStatistics(getMetricStatisticsRequest, null, null, true);

            return(EndGetMetricStatistics(asyncResult));
        }
예제 #10
0
 /// <summary>
 /// Get Metric Statistics
 /// </summary>
 /// <param name="request">Get Metric Statistics  request</param>
 /// <returns>Get Metric Statistics  Response from the service</returns>
 public GetMetricStatisticsResponse GetMetricStatistics(GetMetricStatisticsRequest request)
 {
     return(Invoke <GetMetricStatisticsResponse>(ConvertGetMetricStatistics(request)));
 }