Deregistering a scalable target deletes the scaling policies that are associated with it.
To create a scalable target or update an existing one, see RegisterScalableTarget.
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.ApplicationAutoScaling.Model.DeregisterScalableTargetRequest(); if (cmdletContext.ResourceId != null) { request.ResourceId = cmdletContext.ResourceId; } if (cmdletContext.ScalableDimension != null) { request.ScalableDimension = cmdletContext.ScalableDimension; } if (cmdletContext.ServiceNamespace != null) { request.ServiceNamespace = cmdletContext.ServiceNamespace; } 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); }
private Amazon.ApplicationAutoScaling.Model.DeregisterScalableTargetResponse CallAWSServiceOperation(IAmazonApplicationAutoScaling client, Amazon.ApplicationAutoScaling.Model.DeregisterScalableTargetRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Application Auto Scaling", "DeregisterScalableTarget"); try { #if DESKTOP return(client.DeregisterScalableTarget(request)); #elif CORECLR return(client.DeregisterScalableTargetAsync(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; } }
/// <summary> /// Deregisters a scalable target. /// /// /// <para> /// Deregistering a scalable target deletes the scaling policies that are associated with /// it. /// </para> /// /// <para> /// To create a scalable target or update an existing one, see <a>RegisterScalableTarget</a>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the DeregisterScalableTarget service method.</param> /// /// <returns>The response from the DeregisterScalableTarget service method, as returned by ApplicationAutoScaling.</returns> /// <exception cref="Amazon.ApplicationAutoScaling.Model.ConcurrentUpdateException"> /// Concurrent updates caused an exception, for example, if you request an update to an /// Application Auto Scaling resource that already has a pending update. /// </exception> /// <exception cref="Amazon.ApplicationAutoScaling.Model.InternalServiceException"> /// The service encountered an internal error. /// </exception> /// <exception cref="Amazon.ApplicationAutoScaling.Model.ObjectNotFoundException"> /// The specified object could not be found. For any <code>Put</code> or <code>Register</code> /// API operation, which depends on the existence of a scalable target, this exception /// is thrown if the scalable target with the specified service namespace, resource ID, /// and scalable dimension does not exist. For any <code>Delete</code> or <code>Deregister</code> /// API operation, this exception is thrown if the resource that is to be deleted or deregistered /// cannot be found. /// </exception> /// <exception cref="Amazon.ApplicationAutoScaling.Model.ValidationException"> /// An exception was thrown for a validation issue. Review the available parameters for /// the API request. /// </exception> public DeregisterScalableTargetResponse DeregisterScalableTarget(DeregisterScalableTargetRequest request) { var marshaller = new DeregisterScalableTargetRequestMarshaller(); var unmarshaller = DeregisterScalableTargetResponseUnmarshaller.Instance; return Invoke<DeregisterScalableTargetRequest,DeregisterScalableTargetResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the DeregisterScalableTarget operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeregisterScalableTarget operation on AmazonApplicationAutoScalingClient.</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 EndDeregisterScalableTarget /// operation.</returns> public IAsyncResult BeginDeregisterScalableTarget(DeregisterScalableTargetRequest request, AsyncCallback callback, object state) { var marshaller = new DeregisterScalableTargetRequestMarshaller(); var unmarshaller = DeregisterScalableTargetResponseUnmarshaller.Instance; return BeginInvoke<DeregisterScalableTargetRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// Initiates the asynchronous execution of the DeregisterScalableTarget operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeregisterScalableTarget 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<DeregisterScalableTargetResponse> DeregisterScalableTargetAsync(DeregisterScalableTargetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DeregisterScalableTargetRequestMarshaller(); var unmarshaller = DeregisterScalableTargetResponseUnmarshaller.Instance; return InvokeAsync<DeregisterScalableTargetRequest,DeregisterScalableTargetResponse>(request, marshaller, unmarshaller, cancellationToken); }