Retrieves all alarms for a single metric. Specify a statistic, period, or unit to filter the set of alarms further.
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.CloudWatch.Model.DescribeAlarmsForMetricRequest(); if (cmdletContext.Dimension != null) { request.Dimensions = cmdletContext.Dimension; } if (cmdletContext.ExtendedStatistic != null) { request.ExtendedStatistic = cmdletContext.ExtendedStatistic; } if (cmdletContext.MetricName != null) { request.MetricName = cmdletContext.MetricName; } if (cmdletContext.Namespace != null) { request.Namespace = cmdletContext.Namespace; } if (cmdletContext.Period != null) { request.Period = cmdletContext.Period.Value; } if (cmdletContext.Statistic != null) { request.Statistic = cmdletContext.Statistic; } if (cmdletContext.Unit != null) { request.Unit = cmdletContext.Unit; } CmdletOutput output; // issue call var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); try { var response = CallAWSServiceOperation(client, request); object pipelineOutput = null; pipelineOutput = cmdletContext.Select(response, this); output = new CmdletOutput { PipelineOutput = pipelineOutput, ServiceResponse = response }; } catch (Exception e) { output = new CmdletOutput { ErrorResponse = e }; } return(output); }
/// <summary> /// <para> Retrieves all alarms for a single metric. Specify a statistic, /// period, or unit to filter the set of alarms further. </para> /// </summary> /// /// <param name="describeAlarmsForMetricRequest">Container for the /// necessary parameters to execute the DescribeAlarmsForMetric service /// method on AmazonCloudWatch.</param> /// /// <returns>The response from the DescribeAlarmsForMetric service method, /// as returned by AmazonCloudWatch.</returns> /// public DescribeAlarmsForMetricResponse DescribeAlarmsForMetric(DescribeAlarmsForMetricRequest describeAlarmsForMetricRequest) { IRequest<DescribeAlarmsForMetricRequest> request = new DescribeAlarmsForMetricRequestMarshaller().Marshall(describeAlarmsForMetricRequest); DescribeAlarmsForMetricResponse response = Invoke<DescribeAlarmsForMetricRequest, DescribeAlarmsForMetricResponse> (request, this.signer, DescribeAlarmsForMetricResponseUnmarshaller.GetInstance()); return response; }
/// <summary> /// Initiates the asynchronous execution of the DescribeAlarmsForMetric operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DescribeAlarmsForMetric operation on AmazonCloudWatchClient.</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 EndDescribeAlarmsForMetric /// operation.</returns> public IAsyncResult BeginDescribeAlarmsForMetric(DescribeAlarmsForMetricRequest request, AsyncCallback callback, object state) { var marshaller = new DescribeAlarmsForMetricRequestMarshaller(); var unmarshaller = DescribeAlarmsForMetricResponseUnmarshaller.Instance; return BeginInvoke<DescribeAlarmsForMetricRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// Retrieves all alarms for a single metric. Specify a statistic, period, or unit to /// filter the set of alarms further. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DescribeAlarmsForMetric service method.</param> /// /// <returns>The response from the DescribeAlarmsForMetric service method, as returned by CloudWatch.</returns> public DescribeAlarmsForMetricResponse DescribeAlarmsForMetric(DescribeAlarmsForMetricRequest request) { var marshaller = new DescribeAlarmsForMetricRequestMarshaller(); var unmarshaller = DescribeAlarmsForMetricResponseUnmarshaller.Instance; return Invoke<DescribeAlarmsForMetricRequest,DescribeAlarmsForMetricResponse>(request, marshaller, unmarshaller); }
/// <summary> /// <para> Retrieves all alarms for a single metric. Specify a statistic, period, or unit to filter the set of alarms further. </para> /// </summary> /// /// <param name="describeAlarmsForMetricRequest">Container for the necessary parameters to execute the DescribeAlarmsForMetric service method on /// AmazonCloudWatch.</param> /// /// <returns>The response from the DescribeAlarmsForMetric service method, as returned by AmazonCloudWatch.</returns> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public Task<DescribeAlarmsForMetricResponse> DescribeAlarmsForMetricAsync(DescribeAlarmsForMetricRequest describeAlarmsForMetricRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DescribeAlarmsForMetricRequestMarshaller(); var unmarshaller = DescribeAlarmsForMetricResponseUnmarshaller.GetInstance(); return Invoke<IRequest, DescribeAlarmsForMetricRequest, DescribeAlarmsForMetricResponse>(describeAlarmsForMetricRequest, marshaller, unmarshaller, signer, cancellationToken); }
internal DescribeAlarmsForMetricResponse DescribeAlarmsForMetric(DescribeAlarmsForMetricRequest request) { var task = DescribeAlarmsForMetricAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
/// <summary> /// <para> Retrieves all alarms for a single metric. Specify a statistic, period, or unit to filter the set of alarms further. </para> /// </summary> /// /// <param name="describeAlarmsForMetricRequest">Container for the necessary parameters to execute the DescribeAlarmsForMetric service method on /// AmazonCloudWatch.</param> /// /// <returns>The response from the DescribeAlarmsForMetric service method, as returned by AmazonCloudWatch.</returns> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public async Task<DescribeAlarmsForMetricResponse> DescribeAlarmsForMetricAsync(DescribeAlarmsForMetricRequest describeAlarmsForMetricRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DescribeAlarmsForMetricRequestMarshaller(); var unmarshaller = DescribeAlarmsForMetricResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, DescribeAlarmsForMetricRequest, DescribeAlarmsForMetricResponse>(describeAlarmsForMetricRequest, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
/// AmazonCloudWatch.</param> /// public EnableAlarmActionsResponse EnableAlarmActions(EnableAlarmActionsRequest enableAlarmActionsRequest) { IAsyncResult asyncResult = invokeEnableAlarmActions(enableAlarmActionsRequest, null, null, true); return EndEnableAlarmActions(asyncResult); }
/// 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); } /// <summary> /// Finishes the asynchronous execution of the GetMetricStatistics operation. /// <seealso cref="Amazon.CloudWatch.AmazonCloudWatch.GetMetricStatistics"/>
/// <summary> /// <para> Publishes metric data points to Amazon CloudWatch. Amazon Cloudwatch associates the data points with the specified metric. If the /// specified metric does not exist, Amazon CloudWatch creates the metric. </para> <para><b>NOTE:</b> If you create a metric with the /// PutMetricData action, allow up to fifteen minutes for the metric to appear in calls to the ListMetrics action. </para> <para> The size of a /// PutMetricData request is limited to 8 KB for HTTP GET requests and 40 KB for HTTP POST requests. </para> <para><b>IMPORTANT:</b> Although /// the Value parameter accepts numbers of type Double, Amazon CloudWatch truncates values with very large exponents. Values with base-10 /// exponents greater than 126 (1 x 10^126) are truncated. Likewise, values with base-10 exponents less than -130 (1 x 10^-130) are also /// truncated. </para> /// </summary> /// /// <param name="putMetricDataRequest">Container for the necessary parameters to execute the PutMetricData service method on /// AmazonCloudWatch.</param> /// /// <exception cref="InvalidParameterValueException"/> /// <exception cref="InternalServiceException"/> /// <exception cref="InvalidParameterCombinationException"/>
internal DescribeAlarmsForMetricResponse DescribeAlarmsForMetric(DescribeAlarmsForMetricRequest request) { var task = DescribeAlarmsForMetricAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
/// <summary> /// Initiates the asynchronous execution of the DescribeAlarmsForMetric operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DescribeAlarmsForMetric 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<DescribeAlarmsForMetricResponse> DescribeAlarmsForMetricAsync(DescribeAlarmsForMetricRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DescribeAlarmsForMetricRequestMarshaller(); var unmarshaller = DescribeAlarmsForMetricResponseUnmarshaller.Instance; return InvokeAsync<DescribeAlarmsForMetricRequest,DescribeAlarmsForMetricResponse>(request, marshaller, unmarshaller, cancellationToken); }
public static void CWDescribeAlarmsForMetric() { #region CWDescribeAlarmsForMetric var client = new AmazonCloudWatchClient(); var dimension = new Dimension { Name = "AutoScalingGroupName", Value = "awseb-e-kkbEXAMPLE-stack-AutoScalingGroup-F4TAUEXAMPLE" }; var request = new DescribeAlarmsForMetricRequest { Dimensions = new List<Dimension>() { dimension }, MetricName = "NetworkOut", Namespace = "AWS/EC2" }; var response = client.DescribeAlarmsForMetric(request); if (response.MetricAlarms.Count > 0) { foreach (var alarm in response.MetricAlarms) { Console.WriteLine(); Console.WriteLine(alarm.AlarmName); Console.WriteLine(alarm.AlarmDescription); Console.WriteLine(alarm.MetricName + " " + alarm.ComparisonOperator + " " + alarm.Threshold); } } else { Console.WriteLine("No alarms."); } #endregion Console.ReadLine(); }
private Amazon.CloudWatch.Model.DescribeAlarmsForMetricResponse CallAWSServiceOperation(IAmazonCloudWatch client, Amazon.CloudWatch.Model.DescribeAlarmsForMetricRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon CloudWatch", "DescribeAlarmsForMetric"); try { #if DESKTOP return(client.DescribeAlarmsForMetric(request)); #elif CORECLR return(client.DescribeAlarmsForMetricAsync(request).GetAwaiter().GetResult()); #else #error "Unknown build edition" #endif } catch (AmazonServiceException exc) { var webException = exc.InnerException as System.Net.WebException; if (webException != null) { throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException); } throw; } }