internal virtual EnableAlarmActionsResponse EnableAlarmActions(EnableAlarmActionsRequest request)
        {
            var marshaller   = EnableAlarmActionsRequestMarshaller.Instance;
            var unmarshaller = EnableAlarmActionsResponseUnmarshaller.Instance;

            return(Invoke <EnableAlarmActionsRequest, EnableAlarmActionsResponse>(request, marshaller, unmarshaller));
        }
        /// <summary>
        /// Enables actions for the specified alarms.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the EnableAlarmActions service method.</param>
        ///
        /// <returns>The response from the EnableAlarmActions service method, as returned by CloudWatch.</returns>
        public EnableAlarmActionsResponse EnableAlarmActions(EnableAlarmActionsRequest request)
        {
            var marshaller   = new EnableAlarmActionsRequestMarshaller();
            var unmarshaller = EnableAlarmActionsResponseUnmarshaller.Instance;

            return(Invoke <EnableAlarmActionsRequest, EnableAlarmActionsResponse>(request, marshaller, unmarshaller));
        }
Example #3
0
        /// <summary>
        /// <para> Enables actions for the specified alarms. </para>
        /// </summary>
        ///
        /// <param name="enableAlarmActionsRequest">Container for the necessary parameters to execute the EnableAlarmActions 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 <EnableAlarmActionsResponse> EnableAlarmActionsAsync(EnableAlarmActionsRequest enableAlarmActionsRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new EnableAlarmActionsRequestMarshaller();
            var unmarshaller = EnableAlarmActionsResponseUnmarshaller.GetInstance();

            return(Invoke <IRequest, EnableAlarmActionsRequest, EnableAlarmActionsResponse>(enableAlarmActionsRequest, marshaller, unmarshaller, signer, cancellationToken));
        }
Example #4
0
        /// <summary>
        /// <para> Enables actions for the specified alarms. </para>
        /// </summary>
        ///
        /// <param name="enableAlarmActionsRequest">Container for the necessary
        ///           parameters to execute the EnableAlarmActions service method on
        ///           AmazonCloudWatch.</param>
        ///
        public EnableAlarmActionsResponse EnableAlarmActions(EnableAlarmActionsRequest enableAlarmActionsRequest)
        {
            IRequest <EnableAlarmActionsRequest> request  = new EnableAlarmActionsRequestMarshaller().Marshall(enableAlarmActionsRequest);
            EnableAlarmActionsResponse           response = Invoke <EnableAlarmActionsRequest, EnableAlarmActionsResponse> (request, this.signer, EnableAlarmActionsResponseUnmarshaller.GetInstance());

            return(response);
        }
        /// <summary>
        /// Initiates the asynchronous execution of the EnableAlarmActions operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the EnableAlarmActions 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 <EnableAlarmActionsResponse> EnableAlarmActionsAsync(EnableAlarmActionsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new EnableAlarmActionsRequestMarshaller();
            var unmarshaller = EnableAlarmActionsResponseUnmarshaller.Instance;

            return(InvokeAsync <EnableAlarmActionsRequest, EnableAlarmActionsResponse>(request, marshaller,
                                                                                       unmarshaller, cancellationToken));
        }
Example #6
0
 IAsyncResult invokeEnableAlarmActions(EnableAlarmActionsRequest enableAlarmActionsRequest, AsyncCallback callback, object state, bool synchronized)
 {
     IRequest irequest = new EnableAlarmActionsRequestMarshaller().Marshall(enableAlarmActionsRequest);
     var unmarshaller = EnableAlarmActionsResponseUnmarshaller.GetInstance();
     AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);
     Invoke(result);
     return result;
 }
Example #7
0
        /// <summary>
        /// Initiates the asynchronous execution of the EnableAlarmActions operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the EnableAlarmActions 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/EnableAlarmActions">REST API Reference for EnableAlarmActions Operation</seealso>
        public virtual Task <EnableAlarmActionsResponse> EnableAlarmActionsAsync(EnableAlarmActionsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = EnableAlarmActionsRequestMarshaller.Instance;
            options.ResponseUnmarshaller = EnableAlarmActionsResponseUnmarshaller.Instance;

            return(InvokeAsync <EnableAlarmActionsResponse>(request, options, cancellationToken));
        }
Example #8
0
        internal virtual EnableAlarmActionsResponse EnableAlarmActions(EnableAlarmActionsRequest request)
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = EnableAlarmActionsRequestMarshaller.Instance;
            options.ResponseUnmarshaller = EnableAlarmActionsResponseUnmarshaller.Instance;

            return(Invoke <EnableAlarmActionsResponse>(request, options));
        }
        /// <summary>
        /// Enable 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 enable.</param>
        /// <returns>A Boolean value indicating the success of the call.</returns>
        public static async Task <bool> EnableAlarmActionsAsync(IAmazonCloudWatch client, List <string> alarmNames)
        {
            var request = new EnableAlarmActionsRequest
            {
                AlarmNames = alarmNames,
            };

            var response = await client.EnableAlarmActionsAsync(request);

            return(response.HttpStatusCode == System.Net.HttpStatusCode.OK);
        }
Example #10
0
        internal EnableAlarmActionsResponse EnableAlarmActions(EnableAlarmActionsRequest request)
        {
            var task = EnableAlarmActionsAsync(request);

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

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

            client.EnableAlarmActions(request);
            #endregion
        }
Example #12
0
 /// <summary>
 /// Initiates the asynchronous execution of the EnableAlarmActions operation.
 /// <seealso cref="Amazon.CloudWatch.AmazonCloudWatch.EnableAlarmActions"/>
 /// </summary>
 ///
 /// <param name="enableAlarmActionsRequest">Container for the necessary parameters to execute the EnableAlarmActions 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 BeginEnableAlarmActions(EnableAlarmActionsRequest enableAlarmActionsRequest, AsyncCallback callback, object state)
 {
     return(invokeEnableAlarmActions(enableAlarmActionsRequest, callback, state, false));
 }
Example #13
0
        /// <summary>
        /// <para> Enables actions for the specified alarms. </para>
        /// </summary>
        ///
        /// <param name="enableAlarmActionsRequest">Container for the necessary parameters to execute the EnableAlarmActions service method on
        ///          AmazonCloudWatch.</param>
        ///
        public EnableAlarmActionsResponse EnableAlarmActions(EnableAlarmActionsRequest enableAlarmActionsRequest)
        {
            IAsyncResult asyncResult = invokeEnableAlarmActions(enableAlarmActionsRequest, null, null, true);

            return(EndEnableAlarmActions(asyncResult));
        }
Example #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);
            }
        }