Container for the parameters to the DeleteAutoScalingGroup operation.

Deletes the specified Auto Scaling group if the group has no instances and no scaling activities in progress.

NOTE: To remove all instances before calling DeleteAutoScalingGroup, you can call UpdateAutoScalingGroup to set the minimum and maximum size of the AutoScalingGroup to zero.

Inheritance: AmazonAutoScalingRequest
 protected override void ProcessRecord()
 {
     AmazonAutoScaling client = base.GetClient();
     Amazon.AutoScaling.Model.DeleteAutoScalingGroupRequest request = new Amazon.AutoScaling.Model.DeleteAutoScalingGroupRequest();
     request.AutoScalingGroupName = this._AutoScalingGroupName;
     Amazon.AutoScaling.Model.DeleteAutoScalingGroupResponse response = client.DeleteAutoScalingGroup(request);
 }
示例#2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.AutoScaling.Model.DeleteAutoScalingGroupRequest();

            if (cmdletContext.AutoScalingGroupName != null)
            {
                request.AutoScalingGroupName = cmdletContext.AutoScalingGroupName;
            }
            if (cmdletContext.ForceDelete != null)
            {
                request.ForceDelete = cmdletContext.ForceDelete.Value;
            }

            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>
        /// Initiates the asynchronous execution of the DeleteAutoScalingGroup operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DeleteAutoScalingGroup 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<DeleteAutoScalingGroupResponse> DeleteAutoScalingGroupAsync(DeleteAutoScalingGroupRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new DeleteAutoScalingGroupRequestMarshaller();
            var unmarshaller = DeleteAutoScalingGroupResponseUnmarshaller.Instance;

            return InvokeAsync<DeleteAutoScalingGroupRequest,DeleteAutoScalingGroupResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
        internal DeleteAutoScalingGroupResponse DeleteAutoScalingGroup(DeleteAutoScalingGroupRequest request)
        {
            var marshaller = new DeleteAutoScalingGroupRequestMarshaller();
            var unmarshaller = DeleteAutoScalingGroupResponseUnmarshaller.Instance;

            return Invoke<DeleteAutoScalingGroupRequest,DeleteAutoScalingGroupResponse>(request, marshaller, unmarshaller);
        }
 IAsyncResult invokeDeleteAutoScalingGroup(DeleteAutoScalingGroupRequest deleteAutoScalingGroupRequest, AsyncCallback callback, object state, bool synchronized)
 {
     IRequest irequest = new DeleteAutoScalingGroupRequestMarshaller().Marshall(deleteAutoScalingGroupRequest);
     var unmarshaller = DeleteAutoScalingGroupResponseUnmarshaller.GetInstance();
     AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);
     Invoke(result);
     return result;
 }
 /// <summary>
 /// Initiates the asynchronous execution of the DeleteAutoScalingGroup operation.
 /// <seealso cref="Amazon.AutoScaling.IAmazonAutoScaling.DeleteAutoScalingGroup"/>
 /// </summary>
 /// 
 /// <param name="deleteAutoScalingGroupRequest">Container for the necessary parameters to execute the DeleteAutoScalingGroup 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>
 public IAsyncResult BeginDeleteAutoScalingGroup(DeleteAutoScalingGroupRequest deleteAutoScalingGroupRequest, AsyncCallback callback, object state)
 {
     return invokeDeleteAutoScalingGroup(deleteAutoScalingGroupRequest, callback, state, false);
 }
 /// <summary>
 /// <para> Deletes the specified Auto Scaling group if the group has no instances and no scaling activities in progress. </para>
 /// <para><b>NOTE:</b> To remove all instances before calling DeleteAutoScalingGroup, you can call UpdateAutoScalingGroup to set the minimum and
 /// maximum size of the AutoScalingGroup to zero. </para>
 /// </summary>
 /// 
 /// <param name="deleteAutoScalingGroupRequest">Container for the necessary parameters to execute the DeleteAutoScalingGroup service method on
 ///          AmazonAutoScaling.</param>
 /// 
 /// <exception cref="ResourceInUseException"/>
 /// <exception cref="ScalingActivityInProgressException"/>
 public DeleteAutoScalingGroupResponse DeleteAutoScalingGroup(DeleteAutoScalingGroupRequest deleteAutoScalingGroupRequest)
 {
     IAsyncResult asyncResult = invokeDeleteAutoScalingGroup(deleteAutoScalingGroupRequest, null, null, true);
     return EndDeleteAutoScalingGroup(asyncResult);
 }
        /// <summary>
        /// Initiates the asynchronous execution of the DeleteAutoScalingGroup operation.
        /// <seealso cref="Amazon.AutoScaling.IAmazonAutoScaling.DeleteAutoScalingGroup"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DeleteAutoScalingGroup 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<DeleteAutoScalingGroupResponse> DeleteAutoScalingGroupAsync(DeleteAutoScalingGroupRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new DeleteAutoScalingGroupRequestMarshaller();
            var unmarshaller = DeleteAutoScalingGroupResponseUnmarshaller.GetInstance();
            return Invoke<IRequest, DeleteAutoScalingGroupRequest, DeleteAutoScalingGroupResponse>(request, marshaller, unmarshaller, signer, cancellationToken);
        }
        /// <summary>
        /// <para> Deletes the specified Auto Scaling group if the group has no instances and no scaling activities in progress. </para>
        /// <para><b>NOTE:</b> To remove all instances before calling DeleteAutoScalingGroup, you can call UpdateAutoScalingGroup to set the minimum and
        /// maximum size of the AutoScalingGroup to zero. </para>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DeleteAutoScalingGroup service method on
        /// AmazonAutoScaling.</param>
        /// 
        /// <exception cref="T:Amazon.AutoScaling.Model.ResourceInUseException" />
        /// <exception cref="T:Amazon.AutoScaling.Model.ScalingActivityInProgressException" />
		public DeleteAutoScalingGroupResponse DeleteAutoScalingGroup(DeleteAutoScalingGroupRequest request)
        {
            var task = DeleteAutoScalingGroupAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return null;
            }
        }
        /// <summary>
        /// Initiates the asynchronous execution of the DeleteAutoScalingGroup operation.
        /// <seealso cref="Amazon.AutoScaling.IAmazonAutoScaling"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DeleteAutoScalingGroup 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 EndDeleteAutoScalingGroup
        ///         operation.</returns>
        public IAsyncResult BeginDeleteAutoScalingGroup(DeleteAutoScalingGroupRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new DeleteAutoScalingGroupRequestMarshaller();
            var unmarshaller = DeleteAutoScalingGroupResponseUnmarshaller.Instance;

            return BeginInvoke<DeleteAutoScalingGroupRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
        /// <summary>
        /// Callback function for BeginDescribeScalingActivities async call to monitor the activities of an ASG during shutdown
        /// </summary>
        /// <param name="result"></param>
        private void AutoScalingGroupScalingActivityInfoCallback(IAsyncResult result)
        {
            Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() =>
            {
                AmazonAutoScalingClient client = GetAutoScaleClient();
                DescribeScalingActivitiesResponse resp = client.EndDescribeScalingActivities(result);

                foreach (Activity activity in resp.DescribeScalingActivitiesResult.Activities)
                {
                    if (activity.StatusCode.ToLower() != "successful" && activity.StatusCode.ToLower() != "failed")
                    {
                        return;
                    }
                }

                shutdownTimer.Stop();
                DeleteAutoScalingGroupRequest req = new DeleteAutoScalingGroupRequest();
                ((ViewModel)this.DataContext).BusyContent = "Deleting auto scaling group";
                req.AutoScalingGroupName = ((ViewModel)this.DataContext).SelectedAutoScalingGroup.AutoScalingGroup.AutoScalingGroupName;
                IAsyncResult dasgresult = client.BeginDeleteAutoScalingGroup(req, DeleteAutoScalingGroupCallback, null);
            }));
        }
 /// <summary>
 /// <para> Deletes the specified Auto Scaling group if the group has no instances and no scaling activities in progress. </para>
 /// <para><b>NOTE:</b> To remove all instances before calling DeleteAutoScalingGroup, you can call UpdateAutoScalingGroup to set the minimum and
 /// maximum size of the AutoScalingGroup to zero. </para>
 /// </summary>
 /// 
 /// <param name="deleteAutoScalingGroupRequest">Container for the necessary parameters to execute the DeleteAutoScalingGroup service method on
 ///           AmazonAutoScaling.</param>
 /// 
 /// <exception cref="ResourceInUseException"/>
 /// <exception cref="ScalingActivityInProgressException"/>
 public DeleteAutoScalingGroupResponse DeleteAutoScalingGroup(DeleteAutoScalingGroupRequest deleteAutoScalingGroupRequest)
 {
     IRequest<DeleteAutoScalingGroupRequest> request = new DeleteAutoScalingGroupRequestMarshaller().Marshall(deleteAutoScalingGroupRequest);
     DeleteAutoScalingGroupResponse response = Invoke<DeleteAutoScalingGroupRequest, DeleteAutoScalingGroupResponse> (request, this.signer, DeleteAutoScalingGroupResponseUnmarshaller.GetInstance());
     return response;
 }
		internal DeleteAutoScalingGroupResponse DeleteAutoScalingGroup(DeleteAutoScalingGroupRequest request)
        {
            var task = DeleteAutoScalingGroupAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                throw e.InnerException;
            }
        }
        /// <summary>
        /// Initiates the asynchronous execution of the DeleteAutoScalingGroup operation.
        /// <seealso cref="Amazon.AutoScaling.IAmazonAutoScaling.DeleteAutoScalingGroup"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DeleteAutoScalingGroup 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<DeleteAutoScalingGroupResponse> DeleteAutoScalingGroupAsync(DeleteAutoScalingGroupRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new DeleteAutoScalingGroupRequestMarshaller();
            var unmarshaller = DeleteAutoScalingGroupResponseUnmarshaller.GetInstance();
            var response = await Invoke<IRequest, DeleteAutoScalingGroupRequest, DeleteAutoScalingGroupResponse>(request, marshaller, unmarshaller, signer, cancellationToken)
                .ConfigureAwait(continueOnCapturedContext: false);
            return response;
        }
示例#15
0
 private Amazon.AutoScaling.Model.DeleteAutoScalingGroupResponse CallAWSServiceOperation(IAmazonAutoScaling client, Amazon.AutoScaling.Model.DeleteAutoScalingGroupRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Auto Scaling", "DeleteAutoScalingGroup");
     try
     {
         #if DESKTOP
         return(client.DeleteAutoScalingGroup(request));
         #elif CORECLR
         return(client.DeleteAutoScalingGroupAsync(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;
     }
 }