Example #1
0
        /// <summary>
        /// Notification configuration window load event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void NcWindow_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                AmazonAutoScalingConfig config = new AmazonAutoScalingConfig();
                config.ServiceURL = ((ViewModel)this.DataContext).Region.Url;
                AmazonAutoScalingClient client = new AmazonAutoScalingClient(config);
                DescribeAutoScalingNotificationTypesRequest  dasntreq  = new DescribeAutoScalingNotificationTypesRequest();
                DescribeAutoScalingNotificationTypesResponse dasntresp = client.DescribeAutoScalingNotificationTypes(dasntreq);
                foreach (string asnt in dasntresp.DescribeAutoScalingNotificationTypesResult.AutoScalingNotificationTypes)
                {
                    this.notificationTypes.Add(asnt);
                }

                AmazonSimpleNotificationServiceConfig snsconfig = new AmazonSimpleNotificationServiceConfig();
                config.ServiceURL = ((ViewModel)this.DataContext).Region.Url;
                AmazonSimpleNotificationServiceClient snsclient = new AmazonSimpleNotificationServiceClient(snsconfig);
                ListTopicsRequest  ltrequest = new ListTopicsRequest();
                ListTopicsResponse ltresp    = snsclient.ListTopics(ltrequest);
                foreach (Topic topic in ltresp.ListTopicsResult.Topics)
                {
                    this.snstopics.Add(topic.TopicArn);
                }

                rlbNcTypes.ItemsSource = this.notificationTypes;
                cboTopics.ItemsSource  = this.snstopics;
            }
            catch
            {
                MessageBox.Show(Window.GetWindow(this), "Error occured while loading the notification configuration options.", "Error", MessageBoxButton.OK);
                this.Close();
            }
        }
        /// <summary>
        /// Initiates the asynchronous execution of the DescribeAutoScalingNotificationTypes operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DescribeAutoScalingNotificationTypes 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<DescribeAutoScalingNotificationTypesResponse> DescribeAutoScalingNotificationTypesAsync(DescribeAutoScalingNotificationTypesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new DescribeAutoScalingNotificationTypesRequestMarshaller();
            var unmarshaller = DescribeAutoScalingNotificationTypesResponseUnmarshaller.Instance;

            return InvokeAsync<DescribeAutoScalingNotificationTypesRequest,DescribeAutoScalingNotificationTypesResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
        internal DescribeAutoScalingNotificationTypesResponse DescribeAutoScalingNotificationTypes(DescribeAutoScalingNotificationTypesRequest request)
        {
            var marshaller = new DescribeAutoScalingNotificationTypesRequestMarshaller();
            var unmarshaller = DescribeAutoScalingNotificationTypesResponseUnmarshaller.Instance;

            return Invoke<DescribeAutoScalingNotificationTypesRequest,DescribeAutoScalingNotificationTypesResponse>(request, marshaller, unmarshaller);
        }
 IAsyncResult invokeDescribeAutoScalingNotificationTypes(DescribeAutoScalingNotificationTypesRequest describeAutoScalingNotificationTypesRequest, AsyncCallback callback, object state, bool synchronized)
 {
     IRequest irequest = new DescribeAutoScalingNotificationTypesRequestMarshaller().Marshall(describeAutoScalingNotificationTypesRequest);
     var unmarshaller = DescribeAutoScalingNotificationTypesResponseUnmarshaller.GetInstance();
     AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);
     Invoke(result);
     return result;
 }
 /// <summary>
 /// Initiates the asynchronous execution of the DescribeAutoScalingNotificationTypes operation.
 /// <seealso cref="Amazon.AutoScaling.IAmazonAutoScaling.DescribeAutoScalingNotificationTypes"/>
 /// </summary>
 /// 
 /// <param name="describeAutoScalingNotificationTypesRequest">Container for the necessary parameters to execute the
 ///          DescribeAutoScalingNotificationTypes operation on AmazonAutoScaling.</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
 ///         EndDescribeAutoScalingNotificationTypes operation.</returns>
 public IAsyncResult BeginDescribeAutoScalingNotificationTypes(DescribeAutoScalingNotificationTypesRequest describeAutoScalingNotificationTypesRequest, AsyncCallback callback, object state)
 {
     return invokeDescribeAutoScalingNotificationTypes(describeAutoScalingNotificationTypesRequest, callback, state, false);
 }
 /// <summary>
 /// <para> Returns a list of all notification types that are supported by Auto Scaling. </para>
 /// </summary>
 /// 
 /// <param name="describeAutoScalingNotificationTypesRequest">Container for the necessary parameters to execute the
 ///          DescribeAutoScalingNotificationTypes service method on AmazonAutoScaling.</param>
 /// 
 /// <returns>The response from the DescribeAutoScalingNotificationTypes service method, as returned by AmazonAutoScaling.</returns>
 /// 
 public DescribeAutoScalingNotificationTypesResponse DescribeAutoScalingNotificationTypes(DescribeAutoScalingNotificationTypesRequest describeAutoScalingNotificationTypesRequest)
 {
     IAsyncResult asyncResult = invokeDescribeAutoScalingNotificationTypes(describeAutoScalingNotificationTypesRequest, null, null, true);
     return EndDescribeAutoScalingNotificationTypes(asyncResult);
 }
        /// <summary>
        /// Initiates the asynchronous execution of the DescribeAutoScalingNotificationTypes operation.
        /// <seealso cref="Amazon.AutoScaling.IAmazonAutoScaling.DescribeAutoScalingNotificationTypes"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DescribeAutoScalingNotificationTypes 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<DescribeAutoScalingNotificationTypesResponse> DescribeAutoScalingNotificationTypesAsync(DescribeAutoScalingNotificationTypesRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new DescribeAutoScalingNotificationTypesRequestMarshaller();
            var unmarshaller = DescribeAutoScalingNotificationTypesResponseUnmarshaller.GetInstance();
            return Invoke<IRequest, DescribeAutoScalingNotificationTypesRequest, DescribeAutoScalingNotificationTypesResponse>(request, marshaller, unmarshaller, signer, cancellationToken);
        }
        /// <summary>
        /// <para> Returns a list of all notification types that are supported by Auto Scaling. </para>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the
        /// DescribeAutoScalingNotificationTypes service method on AmazonAutoScaling.</param>
        /// 
        /// <returns>The response from the DescribeAutoScalingNotificationTypes service method, as returned by AmazonAutoScaling.</returns>
		public DescribeAutoScalingNotificationTypesResponse DescribeAutoScalingNotificationTypes(DescribeAutoScalingNotificationTypesRequest request)
        {
            var task = DescribeAutoScalingNotificationTypesAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return null;
            }
        }
        /// <summary>
        /// Initiates the asynchronous execution of the DescribeAutoScalingNotificationTypes operation.
        /// <seealso cref="Amazon.AutoScaling.IAmazonAutoScaling"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DescribeAutoScalingNotificationTypes operation on AmazonAutoScalingClient.</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 EndDescribeAutoScalingNotificationTypes
        ///         operation.</returns>
        public IAsyncResult BeginDescribeAutoScalingNotificationTypes(DescribeAutoScalingNotificationTypesRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new DescribeAutoScalingNotificationTypesRequestMarshaller();
            var unmarshaller = DescribeAutoScalingNotificationTypesResponseUnmarshaller.Instance;

            return BeginInvoke<DescribeAutoScalingNotificationTypesRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
        /// <summary>
        /// <para> Returns a list of all notification types that are supported by Auto Scaling. </para> <para> <i>What if the input is empty?</i>
        /// </para>
        /// </summary>
        ///
        /// <param name="describeAutoScalingNotificationTypesRequest">Container for the necessary parameters to execute the
        ///           DescribeAutoScalingNotificationTypes service method on AmazonAutoScaling.</param>
        ///
        /// <returns>The response from the DescribeAutoScalingNotificationTypes service method, as returned by AmazonAutoScaling.</returns>
        ///
        public DescribeAutoScalingNotificationTypesResponse DescribeAutoScalingNotificationTypes(DescribeAutoScalingNotificationTypesRequest describeAutoScalingNotificationTypesRequest)
        {
            IRequest <DescribeAutoScalingNotificationTypesRequest> request  = new DescribeAutoScalingNotificationTypesRequestMarshaller().Marshall(describeAutoScalingNotificationTypesRequest);
            DescribeAutoScalingNotificationTypesResponse           response = Invoke <DescribeAutoScalingNotificationTypesRequest, DescribeAutoScalingNotificationTypesResponse> (request, this.signer, DescribeAutoScalingNotificationTypesResponseUnmarshaller.GetInstance());

            return(response);
        }
 /// <summary>
 /// <para> Returns a list of all notification types that are supported by Auto Scaling. </para>
 /// </summary>
 /// 
 /// <param name="describeAutoScalingNotificationTypesRequest">Container for the necessary parameters to execute the
 ///           DescribeAutoScalingNotificationTypes service method on AmazonAutoScaling.</param>
 /// 
 /// <returns>The response from the DescribeAutoScalingNotificationTypes service method, as returned by AmazonAutoScaling.</returns>
 /// 
 public DescribeAutoScalingNotificationTypesResponse DescribeAutoScalingNotificationTypes(DescribeAutoScalingNotificationTypesRequest describeAutoScalingNotificationTypesRequest)
 {
     IRequest<DescribeAutoScalingNotificationTypesRequest> request = new DescribeAutoScalingNotificationTypesRequestMarshaller().Marshall(describeAutoScalingNotificationTypesRequest);
     DescribeAutoScalingNotificationTypesResponse response = Invoke<DescribeAutoScalingNotificationTypesRequest, DescribeAutoScalingNotificationTypesResponse> (request, this.signer, DescribeAutoScalingNotificationTypesResponseUnmarshaller.GetInstance());
     return response;
 }
		internal DescribeAutoScalingNotificationTypesResponse DescribeAutoScalingNotificationTypes(DescribeAutoScalingNotificationTypesRequest request)
        {
            var task = DescribeAutoScalingNotificationTypesAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                throw e.InnerException;
            }
        }
        /// <summary>
        /// Initiates the asynchronous execution of the DescribeAutoScalingNotificationTypes operation.
        /// <seealso cref="Amazon.AutoScaling.IAmazonAutoScaling.DescribeAutoScalingNotificationTypes"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DescribeAutoScalingNotificationTypes 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 async Task<DescribeAutoScalingNotificationTypesResponse> DescribeAutoScalingNotificationTypesAsync(DescribeAutoScalingNotificationTypesRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new DescribeAutoScalingNotificationTypesRequestMarshaller();
            var unmarshaller = DescribeAutoScalingNotificationTypesResponseUnmarshaller.GetInstance();
            var response = await Invoke<IRequest, DescribeAutoScalingNotificationTypesRequest, DescribeAutoScalingNotificationTypesResponse>(request, marshaller, unmarshaller, signer, cancellationToken)
                .ConfigureAwait(continueOnCapturedContext: false);
            return response;
        }
        /// <summary>
        /// Notification configuration window load event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void NcWindow_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                AmazonAutoScalingConfig config = new AmazonAutoScalingConfig();
                config.ServiceURL = ((ViewModel)this.DataContext).Region.Url;
                AmazonAutoScalingClient client = new AmazonAutoScalingClient(config);
                DescribeAutoScalingNotificationTypesRequest dasntreq = new DescribeAutoScalingNotificationTypesRequest();
                DescribeAutoScalingNotificationTypesResponse dasntresp = client.DescribeAutoScalingNotificationTypes(dasntreq);
                foreach (string asnt in dasntresp.DescribeAutoScalingNotificationTypesResult.AutoScalingNotificationTypes)
                {
                    this.notificationTypes.Add(asnt);
                }

                AmazonSimpleNotificationServiceConfig snsconfig = new AmazonSimpleNotificationServiceConfig();
                config.ServiceURL = ((ViewModel)this.DataContext).Region.Url;
                AmazonSimpleNotificationServiceClient snsclient = new AmazonSimpleNotificationServiceClient(snsconfig);
                ListTopicsRequest ltrequest = new ListTopicsRequest();
                ListTopicsResponse ltresp = snsclient.ListTopics(ltrequest);
                foreach (Topic topic in ltresp.ListTopicsResult.Topics)
                {
                    this.snstopics.Add(topic.TopicArn);
                }

                rlbNcTypes.ItemsSource = this.notificationTypes;
                cboTopics.ItemsSource = this.snstopics;
            }
            catch
            {
                MessageBox.Show(Window.GetWindow(this), "Error occured while loading the notification configuration options.", "Error", MessageBoxButton.OK);
                this.Close();
            }
        }