/// <summary>
        /// <para> Adjusts the desired size of the AutoScalingGroup by initiating scaling activities. When reducing the size of the group, it is not
        /// possible to define which EC2 instances will be terminated. This applies to any auto-scaling decisions that might result in terminating
        /// instances. </para> <para> There are two common use cases for <c>SetDesiredCapacity</c> :
        /// one for users of the Auto Scaling triggering system, and another for developers who write their own triggering systems. Both use
        /// cases relate to the concept of cooldown. </para> <para> In the first case, if you use the Auto Scaling triggering system,
        /// <c>SetDesiredCapacity</c> changes the size of your Auto Scaling group without regard to the cooldown period. This could be useful, for
        /// example, if Auto Scaling did something unexpected for some reason. If your cooldown period is 10 minutes, Auto Scaling would normally reject
        /// requests to change the size of the group for that entire 10 minute period. The <c>SetDesiredCapacity</c> command allows you to circumvent
        /// this restriction and change the size of the group before the end of the cooldown period. </para> <para> In the second case, if you write
        /// your own triggering system, you can use <c>SetDesiredCapacity</c> to control the size of your Auto Scaling group. If you want the same
        /// cooldown functionality that Auto Scaling offers, you can configure <c>SetDesiredCapacity</c> to honor cooldown by setting the
        /// <c>HonorCooldown</c> parameter to <c>true</c> .
        /// </para>
        /// </summary>
        ///
        /// <param name="setDesiredCapacityRequest">Container for the necessary parameters to execute the SetDesiredCapacity service method on
        ///           AmazonAutoScaling.</param>
        ///
        /// <exception cref="ScalingActivityInProgressException"/>
        public SetDesiredCapacityResponse SetDesiredCapacity(SetDesiredCapacityRequest setDesiredCapacityRequest)
        {
            IRequest <SetDesiredCapacityRequest> request  = new SetDesiredCapacityRequestMarshaller().Marshall(setDesiredCapacityRequest);
            SetDesiredCapacityResponse           response = Invoke <SetDesiredCapacityRequest, SetDesiredCapacityResponse> (request, this.signer, SetDesiredCapacityResponseUnmarshaller.GetInstance());

            return(response);
        }
Example #2
0
        private static IDictionary <string, string> ConvertSetDesiredCapacity(SetDesiredCapacityRequest request)
        {
            IDictionary <string, string> dictionary = new Dictionary <string, string>();

            dictionary["Action"] = "SetDesiredCapacity";
            if (request.IsSetAutoScalingGroupName())
            {
                dictionary["AutoScalingGroupName"] = request.AutoScalingGroupName;
            }
            if (request.IsSetDesiredCapacity())
            {
                dictionary["DesiredCapacity"] = request.DesiredCapacity.ToString();
            }
            return(dictionary);
        }
 /// <summary>
 /// Set Desired Capacity
 /// </summary>
 /// <param name="request">Set Desired Capacity  request</param>
 /// <returns>Set Desired Capacity  Response from the service</returns>
 public SetDesiredCapacityResponse SetDesiredCapacity(SetDesiredCapacityRequest request)
 {
     return(Invoke <SetDesiredCapacityResponse>(ConvertSetDesiredCapacity(request)));
 }