protected override void ProcessRecord()
 {
     AmazonAutoScaling client = base.GetClient();
     Amazon.AutoScaling.Model.DescribeScalingActivitiesRequest request = new Amazon.AutoScaling.Model.DescribeScalingActivitiesRequest();
     if (string.IsNullOrEmpty(this._ActivityIds))
     {
         request.ActivityIds.Add(this._ActivityIds);
     }
     request.AutoScalingGroupName = this._AutoScalingGroupName;
     request.MaxRecords = this._MaxRecords;
     request.NextToken = this._NextToken;
     Amazon.AutoScaling.Model.DescribeScalingActivitiesResponse response = client.DescribeScalingActivities(request);
     base.WriteObject(response.DescribeScalingActivitiesResult, true);
 }
 IAsyncResult invokeDescribeScalingActivities(DescribeScalingActivitiesRequest describeScalingActivitiesRequest, AsyncCallback callback, object state, bool synchronized)
 {
     IRequest irequest = new DescribeScalingActivitiesRequestMarshaller().Marshall(describeScalingActivitiesRequest);
     var unmarshaller = DescribeScalingActivitiesResponseUnmarshaller.GetInstance();
     AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);
     Invoke(result);
     return result;
 }
 /// <summary>
 /// Initiates the asynchronous execution of the DescribeScalingActivities operation.
 /// <seealso cref="Amazon.AutoScaling.IAmazonAutoScaling.DescribeScalingActivities"/>
 /// </summary>
 /// 
 /// <param name="describeScalingActivitiesRequest">Container for the necessary parameters to execute the DescribeScalingActivities 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
 ///         EndDescribeScalingActivities operation.</returns>
 public IAsyncResult BeginDescribeScalingActivities(DescribeScalingActivitiesRequest describeScalingActivitiesRequest, AsyncCallback callback, object state)
 {
     return invokeDescribeScalingActivities(describeScalingActivitiesRequest, callback, state, false);
 }
 /// <summary>
 /// <para> Returns the scaling activities for the specified Auto Scaling group. </para> <para> If the specified <c>ActivityIds</c> list is
 /// empty, all the activities from the past six weeks are returned. Activities are sorted by completion time. Activities still in progress
 /// appear first on the list. </para> <para> This action supports pagination. If the response includes a token, there are more records
 /// available. To get the additional records, repeat the request with the response token as the <c>NextToken</c> parameter. </para>
 /// </summary>
 /// 
 /// <param name="describeScalingActivitiesRequest">Container for the necessary parameters to execute the DescribeScalingActivities service
 ///          method on AmazonAutoScaling.</param>
 /// 
 /// <returns>The response from the DescribeScalingActivities service method, as returned by AmazonAutoScaling.</returns>
 /// 
 /// <exception cref="InvalidNextTokenException"/>
 public DescribeScalingActivitiesResponse DescribeScalingActivities(DescribeScalingActivitiesRequest describeScalingActivitiesRequest)
 {
     IAsyncResult asyncResult = invokeDescribeScalingActivities(describeScalingActivitiesRequest, null, null, true);
     return EndDescribeScalingActivities(asyncResult);
 }
 private Amazon.AutoScaling.Model.DescribeScalingActivitiesResponse CallAWSServiceOperation(IAmazonAutoScaling client, Amazon.AutoScaling.Model.DescribeScalingActivitiesRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Auto Scaling", "DescribeScalingActivities");
     try
     {
         #if DESKTOP
         return(client.DescribeScalingActivities(request));
         #elif CORECLR
         return(client.DescribeScalingActivitiesAsync(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;
     }
 }
        public object Execute(ExecutorContext context)
        {
            var cmdletContext      = context as CmdletContext;
            var useParameterSelect = this.Select.StartsWith("^") || this.PassThru.IsPresent;

            // create request and set iteration invariants
            var request = new Amazon.AutoScaling.Model.DescribeScalingActivitiesRequest();

            if (cmdletContext.ActivityId != null)
            {
                request.ActivityIds = cmdletContext.ActivityId;
            }
            if (cmdletContext.AutoScalingGroupName != null)
            {
                request.AutoScalingGroupName = cmdletContext.AutoScalingGroupName;
            }

            // Initialize loop variants and commence piping
            System.String _nextToken      = null;
            int?          _emitLimit      = null;
            int           _retrievedSoFar = 0;

            if (AutoIterationHelpers.HasValue(cmdletContext.NextToken))
            {
                _nextToken = cmdletContext.NextToken;
            }
            if (AutoIterationHelpers.HasValue(cmdletContext.MaxRecord))
            {
                _emitLimit = cmdletContext.MaxRecord;
            }
            var _userControllingPaging = this.NoAutoIteration.IsPresent || ParameterWasBound(nameof(this.NextToken));

            var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);

            do
            {
                request.NextToken = _nextToken;
                if (_emitLimit.HasValue)
                {
                    request.MaxRecords = AutoIterationHelpers.ConvertEmitLimitToInt32(_emitLimit.Value);
                }

                CmdletOutput output;

                try
                {
                    var    response       = CallAWSServiceOperation(client, request);
                    object pipelineOutput = null;
                    if (!useParameterSelect)
                    {
                        pipelineOutput = cmdletContext.Select(response, this);
                    }
                    output = new CmdletOutput
                    {
                        PipelineOutput  = pipelineOutput,
                        ServiceResponse = response
                    };
                    int _receivedThisCall = response.Activities.Count;

                    _nextToken       = response.NextToken;
                    _retrievedSoFar += _receivedThisCall;
                    if (_emitLimit.HasValue)
                    {
                        _emitLimit -= _receivedThisCall;
                    }
                }
                catch (Exception e)
                {
                    if (_retrievedSoFar == 0 || !_emitLimit.HasValue)
                    {
                        output = new CmdletOutput {
                            ErrorResponse = e
                        };
                    }
                    else
                    {
                        break;
                    }
                }

                ProcessOutput(output);
            } while (!_userControllingPaging && AutoIterationHelpers.HasValue(_nextToken) && (!_emitLimit.HasValue || _emitLimit.Value >= 1));


            if (useParameterSelect)
            {
                WriteObject(cmdletContext.Select(null, this));
            }


            return(null);
        }
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;

            #pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute
            var useParameterSelect = this.Select.StartsWith("^") || this.PassThru.IsPresent;
            #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute

            // create request and set iteration invariants
            var request = new Amazon.AutoScaling.Model.DescribeScalingActivitiesRequest();

            if (cmdletContext.ActivityId != null)
            {
                request.ActivityIds = cmdletContext.ActivityId;
            }
            if (cmdletContext.AutoScalingGroupName != null)
            {
                request.AutoScalingGroupName = cmdletContext.AutoScalingGroupName;
            }
            if (cmdletContext.MaxRecord != null)
            {
                request.MaxRecords = AutoIterationHelpers.ConvertEmitLimitToServiceTypeInt32(cmdletContext.MaxRecord.Value);
            }

            // Initialize loop variant and commence piping
            var _nextToken             = cmdletContext.NextToken;
            var _userControllingPaging = this.NoAutoIteration.IsPresent || ParameterWasBound(nameof(this.NextToken));

            var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);
            do
            {
                request.NextToken = _nextToken;

                CmdletOutput output;

                try
                {
                    var response = CallAWSServiceOperation(client, request);

                    object pipelineOutput = null;
                    if (!useParameterSelect)
                    {
                        pipelineOutput = cmdletContext.Select(response, this);
                    }
                    output = new CmdletOutput
                    {
                        PipelineOutput  = pipelineOutput,
                        ServiceResponse = response
                    };

                    _nextToken = response.NextToken;
                }
                catch (Exception e)
                {
                    output = new CmdletOutput {
                        ErrorResponse = e
                    };
                }

                ProcessOutput(output);
            } while (!_userControllingPaging && AutoIterationHelpers.HasValue(_nextToken));

            if (useParameterSelect)
            {
                WriteObject(cmdletContext.Select(null, this));
            }


            return(null);
        }
        /// <summary>
        /// Initiates the asynchronous execution of the DescribeScalingActivities operation.
        /// <seealso cref="Amazon.AutoScaling.IAmazonAutoScaling.DescribeScalingActivities"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DescribeScalingActivities 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<DescribeScalingActivitiesResponse> DescribeScalingActivitiesAsync(DescribeScalingActivitiesRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new DescribeScalingActivitiesRequestMarshaller();
            var unmarshaller = DescribeScalingActivitiesResponseUnmarshaller.GetInstance();
            var response = await Invoke<IRequest, DescribeScalingActivitiesRequest, DescribeScalingActivitiesResponse>(request, marshaller, unmarshaller, signer, cancellationToken)
                .ConfigureAwait(continueOnCapturedContext: false);
            return response;
        }
        /// <summary>
        /// <para> Returns the scaling activities for the specified Auto Scaling group. </para> <para> If the specified <c>ActivityIds</c> list is
        /// empty, all the activities from the past six weeks are returned. Activities are sorted by the start time. Activities still in progress appear
        /// first on the list. </para> <para> This action supports pagination. If the response includes a token, there are more records available. To
        /// get the additional records, repeat the request with the response token as the <c>NextToken</c> parameter. </para>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DescribeScalingActivities service
        /// method on AmazonAutoScaling.</param>
        /// 
        /// <returns>The response from the DescribeScalingActivities service method, as returned by AmazonAutoScaling.</returns>
        /// 
        /// <exception cref="T:Amazon.AutoScaling.Model.InvalidNextTokenException" />
		public DescribeScalingActivitiesResponse DescribeScalingActivities(DescribeScalingActivitiesRequest request)
        {
            var task = DescribeScalingActivitiesAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return null;
            }
        }
        /// <summary>
        /// Initiates the asynchronous execution of the DescribeScalingActivities operation.
        /// <seealso cref="Amazon.AutoScaling.IAmazonAutoScaling"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DescribeScalingActivities 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 EndDescribeScalingActivities
        ///         operation.</returns>
        public IAsyncResult BeginDescribeScalingActivities(DescribeScalingActivitiesRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new DescribeScalingActivitiesRequestMarshaller();
            var unmarshaller = DescribeScalingActivitiesResponseUnmarshaller.Instance;

            return BeginInvoke<DescribeScalingActivitiesRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
 internal DescribeScalingActivitiesPaginator(IAmazonAutoScaling client, DescribeScalingActivitiesRequest request)
 {
     this._client  = client;
     this._request = request;
 }
 /// <summary>
 /// Paginator for DescribeScalingActivities operation
 ///</summary>
 public IDescribeScalingActivitiesPaginator DescribeScalingActivities(DescribeScalingActivitiesRequest request)
 {
     return(new DescribeScalingActivitiesPaginator(this.client, request));
 }
        /// <summary>
        /// Tick event handler for shutdownTimer to poll AWS for updated information on auto scaling group shutdown
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void shutdownTimer_Tick(object sender, EventArgs e)
        {
            AmazonAutoScalingClient client = GetAutoScaleClient();
            if (shutdownTimer.Tag != null)
            {
                if (shutdownTimer.Tag.ToString() == "activities")
                {
                    DescribeScalingActivitiesRequest req = new DescribeScalingActivitiesRequest();
                    req.AutoScalingGroupName = ((ViewModel)this.DataContext).SelectedAutoScalingGroup.AutoScalingGroup.AutoScalingGroupName;
                    IAsyncResult dasgresult = client.BeginDescribeScalingActivities(req, AutoScalingGroupScalingActivityInfoCallback, null);
                    return;
                }
            }

            DescribeAutoScalingGroupsRequest asreq = new DescribeAutoScalingGroupsRequest();
            IAsyncResult asresult = client.BeginDescribeAutoScalingGroups(asreq, AutoScalingGroupShutdownInfoCallback, shutdownTimer.Tag);
        }
 /// <summary>
 /// <para> Returns the scaling activities for the specified Auto Scaling group. </para> <para> If the specified <c>ActivityIds</c> list is
 /// empty, all the activities from the past six weeks are returned. Activities are sorted by completion time. Activities still in progress
 /// appear first on the list. </para> <para> This action supports pagination. If the response includes a token, there are more records
 /// available. To get the additional records, repeat the request with the response token as the <c>NextToken</c> parameter. </para>
 /// </summary>
 /// 
 /// <param name="describeScalingActivitiesRequest">Container for the necessary parameters to execute the DescribeScalingActivities service
 ///           method on AmazonAutoScaling.</param>
 /// 
 /// <returns>The response from the DescribeScalingActivities service method, as returned by AmazonAutoScaling.</returns>
 /// 
 /// <exception cref="InvalidNextTokenException"/>
 public DescribeScalingActivitiesResponse DescribeScalingActivities(DescribeScalingActivitiesRequest describeScalingActivitiesRequest)
 {
     IRequest<DescribeScalingActivitiesRequest> request = new DescribeScalingActivitiesRequestMarshaller().Marshall(describeScalingActivitiesRequest);
     DescribeScalingActivitiesResponse response = Invoke<DescribeScalingActivitiesRequest, DescribeScalingActivitiesResponse> (request, this.signer, DescribeScalingActivitiesResponseUnmarshaller.GetInstance());
     return response;
 }
		internal DescribeScalingActivitiesResponse DescribeScalingActivities(DescribeScalingActivitiesRequest request)
        {
            var task = DescribeScalingActivitiesAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                throw e.InnerException;
            }
        }
        internal DescribeScalingActivitiesResponse DescribeScalingActivities(DescribeScalingActivitiesRequest request)
        {
            var marshaller = new DescribeScalingActivitiesRequestMarshaller();
            var unmarshaller = DescribeScalingActivitiesResponseUnmarshaller.Instance;

            return Invoke<DescribeScalingActivitiesRequest,DescribeScalingActivitiesResponse>(request, marshaller, unmarshaller);
        }
        /// <summary>
        /// Initiates the asynchronous execution of the DescribeScalingActivities operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DescribeScalingActivities 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<DescribeScalingActivitiesResponse> DescribeScalingActivitiesAsync(DescribeScalingActivitiesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new DescribeScalingActivitiesRequestMarshaller();
            var unmarshaller = DescribeScalingActivitiesResponseUnmarshaller.Instance;

            return InvokeAsync<DescribeScalingActivitiesRequest,DescribeScalingActivitiesResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
        /// <summary>
        /// Initiates the asynchronous execution of the DescribeScalingActivities operation.
        /// <seealso cref="Amazon.AutoScaling.IAmazonAutoScaling.DescribeScalingActivities"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DescribeScalingActivities 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<DescribeScalingActivitiesResponse> DescribeScalingActivitiesAsync(DescribeScalingActivitiesRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new DescribeScalingActivitiesRequestMarshaller();
            var unmarshaller = DescribeScalingActivitiesResponseUnmarshaller.GetInstance();
            return Invoke<IRequest, DescribeScalingActivitiesRequest, DescribeScalingActivitiesResponse>(request, marshaller, unmarshaller, signer, cancellationToken);
        }