Exemplo n.º 1
0
        internal virtual DisableAlarmActionsResponse DisableAlarmActions(DisableAlarmActionsRequest request)
        {
            var marshaller   = DisableAlarmActionsRequestMarshaller.Instance;
            var unmarshaller = DisableAlarmActionsResponseUnmarshaller.Instance;

            return(Invoke <DisableAlarmActionsRequest, DisableAlarmActionsResponse>(request, marshaller, unmarshaller));
        }
        /// <summary>
        /// Disables actions for the specified alarms. When an alarm's actions are disabled the
        /// alarm's state may change, but none of the alarm's actions will execute.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the DisableAlarmActions service method.</param>
        ///
        /// <returns>The response from the DisableAlarmActions service method, as returned by CloudWatch.</returns>
        public DisableAlarmActionsResponse DisableAlarmActions(DisableAlarmActionsRequest request)
        {
            var marshaller   = new DisableAlarmActionsRequestMarshaller();
            var unmarshaller = DisableAlarmActionsResponseUnmarshaller.Instance;

            return(Invoke <DisableAlarmActionsRequest, DisableAlarmActionsResponse>(request, marshaller, unmarshaller));
        }
Exemplo n.º 3
0
        /// <summary>
        /// <para> Disables actions for the specified alarms. When an alarm's actions are disabled the alarm's state may change, but none of the alarm's
        /// actions will execute. </para>
        /// </summary>
        ///
        /// <param name="disableAlarmActionsRequest">Container for the necessary parameters to execute the DisableAlarmActions service method on
        /// AmazonCloudWatch.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        public Task <DisableAlarmActionsResponse> DisableAlarmActionsAsync(DisableAlarmActionsRequest disableAlarmActionsRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new DisableAlarmActionsRequestMarshaller();
            var unmarshaller = DisableAlarmActionsResponseUnmarshaller.GetInstance();

            return(Invoke <IRequest, DisableAlarmActionsRequest, DisableAlarmActionsResponse>(disableAlarmActionsRequest, marshaller, unmarshaller, signer, cancellationToken));
        }
Exemplo n.º 4
0
        /// <summary>
        /// <para> Disables actions for the specified alarms. When an alarm's
        /// actions are disabled the alarm's state may change, but none of the
        /// alarm's actions will execute. </para>
        /// </summary>
        ///
        /// <param name="disableAlarmActionsRequest">Container for the necessary
        ///           parameters to execute the DisableAlarmActions service method on
        ///           AmazonCloudWatch.</param>
        ///
        public DisableAlarmActionsResponse DisableAlarmActions(DisableAlarmActionsRequest disableAlarmActionsRequest)
        {
            IRequest <DisableAlarmActionsRequest> request  = new DisableAlarmActionsRequestMarshaller().Marshall(disableAlarmActionsRequest);
            DisableAlarmActionsResponse           response = Invoke <DisableAlarmActionsRequest, DisableAlarmActionsResponse> (request, this.signer, DisableAlarmActionsResponseUnmarshaller.GetInstance());

            return(response);
        }
        /// <summary>
        /// Initiates the asynchronous execution of the DisableAlarmActions operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the DisableAlarmActions 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 <DisableAlarmActionsResponse> DisableAlarmActionsAsync(DisableAlarmActionsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new DisableAlarmActionsRequestMarshaller();
            var unmarshaller = DisableAlarmActionsResponseUnmarshaller.Instance;

            return(InvokeAsync <DisableAlarmActionsRequest, DisableAlarmActionsResponse>(request, marshaller,
                                                                                         unmarshaller, cancellationToken));
        }
Exemplo n.º 6
0
 IAsyncResult invokeDisableAlarmActions(DisableAlarmActionsRequest disableAlarmActionsRequest, AsyncCallback callback, object state, bool synchronized)
 {
     IRequest irequest = new DisableAlarmActionsRequestMarshaller().Marshall(disableAlarmActionsRequest);
     var unmarshaller = DisableAlarmActionsResponseUnmarshaller.GetInstance();
     AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);
     Invoke(result);
     return result;
 }
Exemplo n.º 7
0
        /// <summary>
        /// Initiates the asynchronous execution of the DisableAlarmActions operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the DisableAlarmActions 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/DisableAlarmActions">REST API Reference for DisableAlarmActions Operation</seealso>
        public virtual Task <DisableAlarmActionsResponse> DisableAlarmActionsAsync(DisableAlarmActionsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = DisableAlarmActionsRequestMarshaller.Instance;
            options.ResponseUnmarshaller = DisableAlarmActionsResponseUnmarshaller.Instance;

            return(InvokeAsync <DisableAlarmActionsResponse>(request, options, cancellationToken));
        }
Exemplo n.º 8
0
        internal virtual DisableAlarmActionsResponse DisableAlarmActions(DisableAlarmActionsRequest request)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = DisableAlarmActionsRequestMarshaller.Instance;
            options.ResponseUnmarshaller = DisableAlarmActionsResponseUnmarshaller.Instance;

            return(Invoke <DisableAlarmActionsResponse>(request, options));
        }
        /// <summary>
        /// Disable the actions for the list of CloudWatch alarm names passed
        /// in the alarmNames parameter.
        /// </summary>
        /// <param name="client">An initialized CloudWatch client object.</param>
        /// <param name="alarmNames">The list of CloudWatch alarms to disable.</param>
        /// <returns>A Boolean value indicating the success of the call.</returns>
        public static async Task <bool> DisableAlarmsActionsAsync(
            IAmazonCloudWatch client,
            List <string> alarmNames)
        {
            var request = new DisableAlarmActionsRequest
            {
                AlarmNames = alarmNames,
            };

            var response = await client.DisableAlarmActionsAsync(request);

            return(response.HttpStatusCode == System.Net.HttpStatusCode.OK);
        }
Exemplo n.º 10
0
        internal DisableAlarmActionsResponse DisableAlarmActions(DisableAlarmActionsRequest request)
        {
            var task = DisableAlarmActionsAsync(request);

            try
            {
                return(task.Result);
            }
            catch (AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return(null);
            }
        }
Exemplo n.º 11
0
        public static void CWDisableAlarmActions()
        {
            #region CWDisableAlarmActions
            var client = new AmazonCloudWatchClient();

            var request = new DisableAlarmActionsRequest
            {
                AlarmNames = new List <string>()
                {
                    "awseb-e-kkbEXAMPLE-stack-CloudwatchAlarmLow-1WVXD9EXAMPLE"
                }
            };

            client.DisableAlarmActions(request);
            #endregion
        }
Exemplo n.º 12
0
 /// <summary>
 /// Initiates the asynchronous execution of the DisableAlarmActions operation.
 /// <seealso cref="Amazon.CloudWatch.AmazonCloudWatch.DisableAlarmActions"/>
 /// </summary>
 ///
 /// <param name="disableAlarmActionsRequest">Container for the necessary parameters to execute the DisableAlarmActions 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>
 public IAsyncResult BeginDisableAlarmActions(DisableAlarmActionsRequest disableAlarmActionsRequest, AsyncCallback callback, object state)
 {
     return(invokeDisableAlarmActions(disableAlarmActionsRequest, callback, state, false));
 }
Exemplo n.º 13
0
        /// <summary>
        /// <para> Disables actions for the specified alarms. When an alarm's actions are disabled the alarm's state may change, but none of the alarm's
        /// actions will execute. </para>
        /// </summary>
        ///
        /// <param name="disableAlarmActionsRequest">Container for the necessary parameters to execute the DisableAlarmActions service method on
        ///          AmazonCloudWatch.</param>
        ///
        public DisableAlarmActionsResponse DisableAlarmActions(DisableAlarmActionsRequest disableAlarmActionsRequest)
        {
            IAsyncResult asyncResult = invokeDisableAlarmActions(disableAlarmActionsRequest, null, null, true);

            return(EndDisableAlarmActions(asyncResult));
        }
Exemplo n.º 14
0
        public void TestDisableEnableAlarms()
        {
            String metricName = this.GetType().Name + DateTime.Now.Ticks;

            PutMetricAlarmRequest[] rqs = CreateTwoNewAlarms(metricName);

            PutMetricAlarmRequest rq1 = rqs[0];
            PutMetricAlarmRequest rq2 = rqs[1];

            /*
             * Disable
             */
            DisableAlarmActionsRequest disable = new DisableAlarmActionsRequest()
            {
                AlarmNames = new List <string> {
                    rq1.AlarmName, rq2.AlarmName
                }
            };

            Client.DisableAlarmActions(disable);

            DescribeAlarmsForMetricResult describeResult = Client.DescribeAlarmsForMetric(new DescribeAlarmsForMetricRequest()
            {
                Dimensions = rq1.Dimensions,
                MetricName = metricName,
                Namespace  = rq1.Namespace
            });

            Assert.AreEqual(2, describeResult.MetricAlarms.Count);
            foreach (MetricAlarm alarm in describeResult.MetricAlarms)
            {
                Assert.IsTrue(rq1.AlarmName.Equals(alarm.AlarmName) || rq2.AlarmName.Equals(alarm.AlarmName));
                Assert.IsFalse(alarm.ActionsEnabled);
            }

            /*
             * Enable
             */
            EnableAlarmActionsRequest enable = new EnableAlarmActionsRequest()
            {
                AlarmNames = new List <string> {
                    rq1.AlarmName, rq2.AlarmName
                }
            };

            Client.EnableAlarmActions(enable);

            describeResult = Client.DescribeAlarmsForMetric(new DescribeAlarmsForMetricRequest()
            {
                Dimensions = rq1.Dimensions,
                MetricName = metricName,
                Namespace  = rq1.Namespace
            });

            Assert.AreEqual(2, describeResult.MetricAlarms.Count);
            foreach (MetricAlarm alarm in describeResult.MetricAlarms)
            {
                Assert.IsTrue(rq1.AlarmName.Equals(alarm.AlarmName) ||
                              rq2.AlarmName.Equals(alarm.AlarmName));
                Assert.IsTrue(alarm.ActionsEnabled);
            }
        }