Container for the parameters to the SetLoadBasedAutoScaling operation. Specify the load-based auto scaling configuration for a specified layer. For more information, see Managing Load with Time-based and Load-based Instances.

To use load-based auto scaling, you must create a set of load-based auto scaling instances. Load-based auto scaling operates only on the instances from that set, so you must ensure that you have created enough instances to handle the maximum anticipated load.

Required Permissions: To use this action, an IAM user must have a Manage permissions level for the stack, or an attached policy that explicitly grants permissions. For more information on user permissions, see Managing User Permissions.

Inheritance: AmazonOpsWorksRequest
コード例 #1
0
        internal SetLoadBasedAutoScalingResponse SetLoadBasedAutoScaling(SetLoadBasedAutoScalingRequest request)
        {
            var marshaller = new SetLoadBasedAutoScalingRequestMarshaller();
            var unmarshaller = SetLoadBasedAutoScalingResponseUnmarshaller.Instance;

            return Invoke<SetLoadBasedAutoScalingRequest,SetLoadBasedAutoScalingResponse>(request, marshaller, unmarshaller);
        }
コード例 #2
0
        /// <summary>
        /// Initiates the asynchronous execution of the SetLoadBasedAutoScaling operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the SetLoadBasedAutoScaling 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<SetLoadBasedAutoScalingResponse> SetLoadBasedAutoScalingAsync(SetLoadBasedAutoScalingRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new SetLoadBasedAutoScalingRequestMarshaller();
            var unmarshaller = SetLoadBasedAutoScalingResponseUnmarshaller.Instance;

            return InvokeAsync<SetLoadBasedAutoScalingRequest,SetLoadBasedAutoScalingResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
コード例 #3
0
		internal SetLoadBasedAutoScalingResponse SetLoadBasedAutoScaling(SetLoadBasedAutoScalingRequest request)
        {
            var task = SetLoadBasedAutoScalingAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return null;
            }
        }
コード例 #4
0
        /// <summary>
        /// <para>Specify the load-based auto scaling configuration for a specified layer. For more information, see <a href="http://docs.aws.amazon.com/opsworks/latest/userguide/workinginstances-autoscaling.html">Managing Load with Time-based and Load-based
        /// Instances</a> .</para> <para><b>NOTE:</b>To use load-based auto scaling, you must create a set of load-based auto scaling instances.
        /// Load-based auto scaling operates only on the instances from that set, so you must ensure that you have created enough instances to handle
        /// the maximum anticipated load.</para> <para> <b>Required Permissions</b> : To use this action, an IAM user must have a Manage permissions
        /// level for the stack, or an attached policy that explicitly grants permissions. For more information on user permissions, see <a href="http://docs.aws.amazon.com/opsworks/latest/userguide/opsworks-security-users.html">Managing User Permissions</a> .</para>
        /// </summary>
        /// 
        /// <param name="setLoadBasedAutoScalingRequest">Container for the necessary parameters to execute the SetLoadBasedAutoScaling service method on
        /// AmazonOpsWorks.</param>
        /// 
        /// <exception cref="T:Amazon.OpsWorks.Model.ResourceNotFoundException" />
        /// <exception cref="T:Amazon.OpsWorks.Model.ValidationException" />
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
		public Task<SetLoadBasedAutoScalingResponse> SetLoadBasedAutoScalingAsync(SetLoadBasedAutoScalingRequest setLoadBasedAutoScalingRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new SetLoadBasedAutoScalingRequestMarshaller();
            var unmarshaller = SetLoadBasedAutoScalingResponseUnmarshaller.GetInstance();
            return Invoke<IRequest, SetLoadBasedAutoScalingRequest, SetLoadBasedAutoScalingResponse>(setLoadBasedAutoScalingRequest, marshaller, unmarshaller, signer, cancellationToken);
        }
 private Amazon.OpsWorks.Model.SetLoadBasedAutoScalingResponse CallAWSServiceOperation(IAmazonOpsWorks client, Amazon.OpsWorks.Model.SetLoadBasedAutoScalingRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS OpsWorks", "SetLoadBasedAutoScaling");
     try
     {
         #if DESKTOP
         return(client.SetLoadBasedAutoScaling(request));
         #elif CORECLR
         return(client.SetLoadBasedAutoScalingAsync(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;
     }
 }
コード例 #6
0
        /// <summary>
        /// Initiates the asynchronous execution of the SetLoadBasedAutoScaling operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the SetLoadBasedAutoScaling operation on AmazonOpsWorksClient.</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 EndSetLoadBasedAutoScaling
        ///         operation.</returns>
        public IAsyncResult BeginSetLoadBasedAutoScaling(SetLoadBasedAutoScalingRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new SetLoadBasedAutoScalingRequestMarshaller();
            var unmarshaller = SetLoadBasedAutoScalingResponseUnmarshaller.Instance;

            return BeginInvoke<SetLoadBasedAutoScalingRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
コード例 #7
0
 IAsyncResult invokeSetLoadBasedAutoScaling(SetLoadBasedAutoScalingRequest setLoadBasedAutoScalingRequest, AsyncCallback callback, object state, bool synchronized)
 {
     IRequest irequest = new SetLoadBasedAutoScalingRequestMarshaller().Marshall(setLoadBasedAutoScalingRequest);
     var unmarshaller = SetLoadBasedAutoScalingResponseUnmarshaller.GetInstance();
     AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);
     Invoke(result);
     return result;
 }
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.OpsWorks.Model.SetLoadBasedAutoScalingRequest();


            // populate DownScaling
            var requestDownScalingIsNull = true;

            request.DownScaling = new Amazon.OpsWorks.Model.AutoScalingThresholds();
            List <System.String> requestDownScaling_downScaling_Alarm = null;

            if (cmdletContext.DownScaling_Alarm != null)
            {
                requestDownScaling_downScaling_Alarm = cmdletContext.DownScaling_Alarm;
            }
            if (requestDownScaling_downScaling_Alarm != null)
            {
                request.DownScaling.Alarms = requestDownScaling_downScaling_Alarm;
                requestDownScalingIsNull   = false;
            }
            System.Double?requestDownScaling_downScaling_CpuThreshold = null;
            if (cmdletContext.DownScaling_CpuThreshold != null)
            {
                requestDownScaling_downScaling_CpuThreshold = cmdletContext.DownScaling_CpuThreshold.Value;
            }
            if (requestDownScaling_downScaling_CpuThreshold != null)
            {
                request.DownScaling.CpuThreshold = requestDownScaling_downScaling_CpuThreshold.Value;
                requestDownScalingIsNull         = false;
            }
            System.Int32?requestDownScaling_downScaling_IgnoreMetricsTime = null;
            if (cmdletContext.DownScaling_IgnoreMetricsTime != null)
            {
                requestDownScaling_downScaling_IgnoreMetricsTime = cmdletContext.DownScaling_IgnoreMetricsTime.Value;
            }
            if (requestDownScaling_downScaling_IgnoreMetricsTime != null)
            {
                request.DownScaling.IgnoreMetricsTime = requestDownScaling_downScaling_IgnoreMetricsTime.Value;
                requestDownScalingIsNull = false;
            }
            System.Int32?requestDownScaling_downScaling_InstanceCount = null;
            if (cmdletContext.DownScaling_InstanceCount != null)
            {
                requestDownScaling_downScaling_InstanceCount = cmdletContext.DownScaling_InstanceCount.Value;
            }
            if (requestDownScaling_downScaling_InstanceCount != null)
            {
                request.DownScaling.InstanceCount = requestDownScaling_downScaling_InstanceCount.Value;
                requestDownScalingIsNull          = false;
            }
            System.Double?requestDownScaling_downScaling_LoadThreshold = null;
            if (cmdletContext.DownScaling_LoadThreshold != null)
            {
                requestDownScaling_downScaling_LoadThreshold = cmdletContext.DownScaling_LoadThreshold.Value;
            }
            if (requestDownScaling_downScaling_LoadThreshold != null)
            {
                request.DownScaling.LoadThreshold = requestDownScaling_downScaling_LoadThreshold.Value;
                requestDownScalingIsNull          = false;
            }
            System.Double?requestDownScaling_downScaling_MemoryThreshold = null;
            if (cmdletContext.DownScaling_MemoryThreshold != null)
            {
                requestDownScaling_downScaling_MemoryThreshold = cmdletContext.DownScaling_MemoryThreshold.Value;
            }
            if (requestDownScaling_downScaling_MemoryThreshold != null)
            {
                request.DownScaling.MemoryThreshold = requestDownScaling_downScaling_MemoryThreshold.Value;
                requestDownScalingIsNull            = false;
            }
            System.Int32?requestDownScaling_downScaling_ThresholdsWaitTime = null;
            if (cmdletContext.DownScaling_ThresholdsWaitTime != null)
            {
                requestDownScaling_downScaling_ThresholdsWaitTime = cmdletContext.DownScaling_ThresholdsWaitTime.Value;
            }
            if (requestDownScaling_downScaling_ThresholdsWaitTime != null)
            {
                request.DownScaling.ThresholdsWaitTime = requestDownScaling_downScaling_ThresholdsWaitTime.Value;
                requestDownScalingIsNull = false;
            }
            // determine if request.DownScaling should be set to null
            if (requestDownScalingIsNull)
            {
                request.DownScaling = null;
            }
            if (cmdletContext.Enable != null)
            {
                request.Enable = cmdletContext.Enable.Value;
            }
            if (cmdletContext.LayerId != null)
            {
                request.LayerId = cmdletContext.LayerId;
            }

            // populate UpScaling
            var requestUpScalingIsNull = true;

            request.UpScaling = new Amazon.OpsWorks.Model.AutoScalingThresholds();
            List <System.String> requestUpScaling_upScaling_Alarm = null;

            if (cmdletContext.UpScaling_Alarm != null)
            {
                requestUpScaling_upScaling_Alarm = cmdletContext.UpScaling_Alarm;
            }
            if (requestUpScaling_upScaling_Alarm != null)
            {
                request.UpScaling.Alarms = requestUpScaling_upScaling_Alarm;
                requestUpScalingIsNull   = false;
            }
            System.Double?requestUpScaling_upScaling_CpuThreshold = null;
            if (cmdletContext.UpScaling_CpuThreshold != null)
            {
                requestUpScaling_upScaling_CpuThreshold = cmdletContext.UpScaling_CpuThreshold.Value;
            }
            if (requestUpScaling_upScaling_CpuThreshold != null)
            {
                request.UpScaling.CpuThreshold = requestUpScaling_upScaling_CpuThreshold.Value;
                requestUpScalingIsNull         = false;
            }
            System.Int32?requestUpScaling_upScaling_IgnoreMetricsTime = null;
            if (cmdletContext.UpScaling_IgnoreMetricsTime != null)
            {
                requestUpScaling_upScaling_IgnoreMetricsTime = cmdletContext.UpScaling_IgnoreMetricsTime.Value;
            }
            if (requestUpScaling_upScaling_IgnoreMetricsTime != null)
            {
                request.UpScaling.IgnoreMetricsTime = requestUpScaling_upScaling_IgnoreMetricsTime.Value;
                requestUpScalingIsNull = false;
            }
            System.Int32?requestUpScaling_upScaling_InstanceCount = null;
            if (cmdletContext.UpScaling_InstanceCount != null)
            {
                requestUpScaling_upScaling_InstanceCount = cmdletContext.UpScaling_InstanceCount.Value;
            }
            if (requestUpScaling_upScaling_InstanceCount != null)
            {
                request.UpScaling.InstanceCount = requestUpScaling_upScaling_InstanceCount.Value;
                requestUpScalingIsNull          = false;
            }
            System.Double?requestUpScaling_upScaling_LoadThreshold = null;
            if (cmdletContext.UpScaling_LoadThreshold != null)
            {
                requestUpScaling_upScaling_LoadThreshold = cmdletContext.UpScaling_LoadThreshold.Value;
            }
            if (requestUpScaling_upScaling_LoadThreshold != null)
            {
                request.UpScaling.LoadThreshold = requestUpScaling_upScaling_LoadThreshold.Value;
                requestUpScalingIsNull          = false;
            }
            System.Double?requestUpScaling_upScaling_MemoryThreshold = null;
            if (cmdletContext.UpScaling_MemoryThreshold != null)
            {
                requestUpScaling_upScaling_MemoryThreshold = cmdletContext.UpScaling_MemoryThreshold.Value;
            }
            if (requestUpScaling_upScaling_MemoryThreshold != null)
            {
                request.UpScaling.MemoryThreshold = requestUpScaling_upScaling_MemoryThreshold.Value;
                requestUpScalingIsNull            = false;
            }
            System.Int32?requestUpScaling_upScaling_ThresholdsWaitTime = null;
            if (cmdletContext.UpScaling_ThresholdsWaitTime != null)
            {
                requestUpScaling_upScaling_ThresholdsWaitTime = cmdletContext.UpScaling_ThresholdsWaitTime.Value;
            }
            if (requestUpScaling_upScaling_ThresholdsWaitTime != null)
            {
                request.UpScaling.ThresholdsWaitTime = requestUpScaling_upScaling_ThresholdsWaitTime.Value;
                requestUpScalingIsNull = false;
            }
            // determine if request.UpScaling should be set to null
            if (requestUpScalingIsNull)
            {
                request.UpScaling = 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);
        }
コード例 #9
0
 /// <summary>
 /// Initiates the asynchronous execution of the SetLoadBasedAutoScaling operation.
 /// <seealso cref="Amazon.OpsWorks.IAmazonOpsWorks.SetLoadBasedAutoScaling"/>
 /// </summary>
 /// 
 /// <param name="setLoadBasedAutoScalingRequest">Container for the necessary parameters to execute the SetLoadBasedAutoScaling operation on
 ///          AmazonOpsWorks.</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 BeginSetLoadBasedAutoScaling(SetLoadBasedAutoScalingRequest setLoadBasedAutoScalingRequest, AsyncCallback callback, object state)
 {
     return invokeSetLoadBasedAutoScaling(setLoadBasedAutoScalingRequest, callback, state, false);
 }
コード例 #10
0
 /// <summary>
 /// <para>Specify the load-based auto scaling configuration for a specified layer. For more information, see <a
 /// href="http://docs.aws.amazon.com/opsworks/latest/userguide/workinginstances-autoscaling.html" >Managing Load with Time-based and Load-based
 /// Instances</a> .</para> <para><b>NOTE:</b>To use load-based auto scaling, you must create a set of load-based auto scaling instances.
 /// Load-based auto scaling operates only on the instances from that set, so you must ensure that you have created enough instances to handle
 /// the maximum anticipated load.</para> <para> <b>Required Permissions</b> : To use this action, an IAM user must have a Manage permissions
 /// level for the stack, or an attached policy that explicitly grants permissions. For more information on user permissions, see <a
 /// href="http://docs.aws.amazon.com/opsworks/latest/userguide/opsworks-security-users.html" >Managing User Permissions</a> .</para>
 /// </summary>
 /// 
 /// <param name="setLoadBasedAutoScalingRequest">Container for the necessary parameters to execute the SetLoadBasedAutoScaling service method on
 ///          AmazonOpsWorks.</param>
 /// 
 /// <exception cref="ResourceNotFoundException"/>
 /// <exception cref="ValidationException"/>
 public SetLoadBasedAutoScalingResponse SetLoadBasedAutoScaling(SetLoadBasedAutoScalingRequest setLoadBasedAutoScalingRequest)
 {
     IAsyncResult asyncResult = invokeSetLoadBasedAutoScaling(setLoadBasedAutoScalingRequest, null, null, true);
     return EndSetLoadBasedAutoScaling(asyncResult);
 }
コード例 #11
0
        IAsyncResult invokeSetLoadBasedAutoScaling(SetLoadBasedAutoScalingRequest request, AsyncCallback callback, object state, bool synchronized)
        {
            var marshaller = new SetLoadBasedAutoScalingRequestMarshaller();
            var unmarshaller = SetLoadBasedAutoScalingResponseUnmarshaller.Instance;

            return Invoke(request, callback, state, synchronized, marshaller, unmarshaller, signer);
        }
コード例 #12
0
        /// <summary>
        /// Initiates the asynchronous execution of the SetLoadBasedAutoScaling operation.
        /// <seealso cref="Amazon.OpsWorks.IAmazonOpsWorks.SetLoadBasedAutoScaling"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the SetLoadBasedAutoScaling 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<SetLoadBasedAutoScalingResponse> SetLoadBasedAutoScalingAsync(SetLoadBasedAutoScalingRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new SetLoadBasedAutoScalingRequestMarshaller();
            var unmarshaller = SetLoadBasedAutoScalingResponseUnmarshaller.GetInstance();
            var response = await Invoke<IRequest, SetLoadBasedAutoScalingRequest, SetLoadBasedAutoScalingResponse>(request, marshaller, unmarshaller, signer, cancellationToken)
                .ConfigureAwait(continueOnCapturedContext: false);
            return response;
        }
コード例 #13
0
        /// <summary>
        /// <para>Specify the load-based auto scaling configuration for a specified layer. For more information, see <a href="http://docs.aws.amazon.com/opsworks/latest/userguide/workinginstances-autoscaling.html">Managing Load with Time-based and Load-based
        /// Instances</a> .</para> <para><b>NOTE:</b>To use load-based auto scaling, you must create a set of load-based auto scaling instances.
        /// Load-based auto scaling operates only on the instances from that set, so you must ensure that you have created enough instances to handle
        /// the maximum anticipated load.</para>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the SetLoadBasedAutoScaling service method on
        /// AmazonOpsWorks.</param>
        /// 
        /// <exception cref="T:Amazon.OpsWorks.Model.ResourceNotFoundException" />
        /// <exception cref="T:Amazon.OpsWorks.Model.ValidationException" />
		public SetLoadBasedAutoScalingResponse SetLoadBasedAutoScaling(SetLoadBasedAutoScalingRequest request)
        {
            var task = SetLoadBasedAutoScalingAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                throw e.InnerException;
            }
        }