Container for the parameters to the RegisterScalableTarget operation. Registers or updates a scalable target. A scalable target is a resource that Application Auto Scaling can scale out or scale in. After you have registered a scalable target, you can use this operation to update the minimum and maximum values for your scalable dimension.

After you register a scalable target, you can create and apply scaling policies using PutScalingPolicy. You can view the scaling policies for a service namespace using DescribeScalableTargets. If you are no longer using a scalable target, you can deregister it using DeregisterScalableTarget.

Inheritance: AmazonApplicationAutoScalingRequest
Ejemplo n.º 1
0
 private Amazon.ApplicationAutoScaling.Model.RegisterScalableTargetResponse CallAWSServiceOperation(IAmazonApplicationAutoScaling client, Amazon.ApplicationAutoScaling.Model.RegisterScalableTargetRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Application Auto Scaling", "RegisterScalableTarget");
     try
     {
         #if DESKTOP
         return(client.RegisterScalableTarget(request));
         #elif CORECLR
         return(client.RegisterScalableTargetAsync(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;
     }
 }
Ejemplo n.º 2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.ApplicationAutoScaling.Model.RegisterScalableTargetRequest();

            if (cmdletContext.MaxCapacity != null)
            {
                request.MaxCapacity = cmdletContext.MaxCapacity.Value;
            }
            if (cmdletContext.MinCapacity != null)
            {
                request.MinCapacity = cmdletContext.MinCapacity.Value;
            }
            if (cmdletContext.ResourceId != null)
            {
                request.ResourceId = cmdletContext.ResourceId;
            }
            if (cmdletContext.RoleARN != null)
            {
                request.RoleARN = cmdletContext.RoleARN;
            }
            if (cmdletContext.ScalableDimension != null)
            {
                request.ScalableDimension = cmdletContext.ScalableDimension;
            }
            if (cmdletContext.ServiceNamespace != null)
            {
                request.ServiceNamespace = cmdletContext.ServiceNamespace;
            }

            // populate SuspendedState
            var requestSuspendedStateIsNull = true;

            request.SuspendedState = new Amazon.ApplicationAutoScaling.Model.SuspendedState();
            System.Boolean?requestSuspendedState_suspendedState_DynamicScalingInSuspended = null;
            if (cmdletContext.SuspendedState_DynamicScalingInSuspended != null)
            {
                requestSuspendedState_suspendedState_DynamicScalingInSuspended = cmdletContext.SuspendedState_DynamicScalingInSuspended.Value;
            }
            if (requestSuspendedState_suspendedState_DynamicScalingInSuspended != null)
            {
                request.SuspendedState.DynamicScalingInSuspended = requestSuspendedState_suspendedState_DynamicScalingInSuspended.Value;
                requestSuspendedStateIsNull = false;
            }
            System.Boolean?requestSuspendedState_suspendedState_DynamicScalingOutSuspended = null;
            if (cmdletContext.SuspendedState_DynamicScalingOutSuspended != null)
            {
                requestSuspendedState_suspendedState_DynamicScalingOutSuspended = cmdletContext.SuspendedState_DynamicScalingOutSuspended.Value;
            }
            if (requestSuspendedState_suspendedState_DynamicScalingOutSuspended != null)
            {
                request.SuspendedState.DynamicScalingOutSuspended = requestSuspendedState_suspendedState_DynamicScalingOutSuspended.Value;
                requestSuspendedStateIsNull = false;
            }
            System.Boolean?requestSuspendedState_suspendedState_ScheduledScalingSuspended = null;
            if (cmdletContext.SuspendedState_ScheduledScalingSuspended != null)
            {
                requestSuspendedState_suspendedState_ScheduledScalingSuspended = cmdletContext.SuspendedState_ScheduledScalingSuspended.Value;
            }
            if (requestSuspendedState_suspendedState_ScheduledScalingSuspended != null)
            {
                request.SuspendedState.ScheduledScalingSuspended = requestSuspendedState_suspendedState_ScheduledScalingSuspended.Value;
                requestSuspendedStateIsNull = false;
            }
            // determine if request.SuspendedState should be set to null
            if (requestSuspendedStateIsNull)
            {
                request.SuspendedState = null;
            }

            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>
        /// Registers or updates a scalable target. A scalable target is a resource that Application
        /// Auto Scaling can scale out or scale in. After you have registered a scalable target,
        /// you can use this operation to update the minimum and maximum values for your scalable
        /// dimension.
        /// 
        ///  
        /// <para>
        /// After you register a scalable target, you can create and apply scaling policies using
        /// <a>PutScalingPolicy</a>. You can view the scaling policies for a service namespace
        /// using <a>DescribeScalableTargets</a>. If you are no longer using a scalable target,
        /// you can deregister it using <a>DeregisterScalableTarget</a>.
        /// </para>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the RegisterScalableTarget service method.</param>
        /// 
        /// <returns>The response from the RegisterScalableTarget 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.LimitExceededException">
        /// Your account exceeded a limit. This exception is thrown when a per-account resource
        /// limit is exceeded. For more information, see <a href="http://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html#limits_as-app">Application
        /// Auto Scaling Limits</a>.
        /// </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 RegisterScalableTargetResponse RegisterScalableTarget(RegisterScalableTargetRequest request)
        {
            var marshaller = new RegisterScalableTargetRequestMarshaller();
            var unmarshaller = RegisterScalableTargetResponseUnmarshaller.Instance;

            return Invoke<RegisterScalableTargetRequest,RegisterScalableTargetResponse>(request, marshaller, unmarshaller);
        }
        /// <summary>
        /// Initiates the asynchronous execution of the RegisterScalableTarget operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the RegisterScalableTarget 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 EndRegisterScalableTarget
        ///         operation.</returns>
        public IAsyncResult BeginRegisterScalableTarget(RegisterScalableTargetRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new RegisterScalableTargetRequestMarshaller();
            var unmarshaller = RegisterScalableTargetResponseUnmarshaller.Instance;

            return BeginInvoke<RegisterScalableTargetRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
        /// <summary>
        /// Initiates the asynchronous execution of the RegisterScalableTarget operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the RegisterScalableTarget 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<RegisterScalableTargetResponse> RegisterScalableTargetAsync(RegisterScalableTargetRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new RegisterScalableTargetRequestMarshaller();
            var unmarshaller = RegisterScalableTargetResponseUnmarshaller.Instance;

            return InvokeAsync<RegisterScalableTargetRequest,RegisterScalableTargetResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }