本文整理匯總了Golang中github.com/aws/aws-sdk-go/service/autoscaling.AutoScaling.SuspendProcesses方法的典型用法代碼示例。如果您正苦於以下問題:Golang AutoScaling.SuspendProcesses方法的具體用法?Golang AutoScaling.SuspendProcesses怎麽用?Golang AutoScaling.SuspendProcesses使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/aws/aws-sdk-go/service/autoscaling.AutoScaling
的用法示例。
在下文中一共展示了AutoScaling.SuspendProcesses方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: enableASGSuspendedProcesses
func enableASGSuspendedProcesses(d *schema.ResourceData, conn *autoscaling.AutoScaling) error {
props := &autoscaling.ScalingProcessQuery{
AutoScalingGroupName: aws.String(d.Id()),
ScalingProcesses: expandStringList(d.Get("suspended_processes").(*schema.Set).List()),
}
_, err := conn.SuspendProcesses(props)
if err != nil {
return err
}
return nil
}
示例2: updateASGSuspendedProcesses
func updateASGSuspendedProcesses(d *schema.ResourceData, conn *autoscaling.AutoScaling) error {
o, n := d.GetChange("suspended_processes")
if o == nil {
o = new(schema.Set)
}
if n == nil {
n = new(schema.Set)
}
os := o.(*schema.Set)
ns := n.(*schema.Set)
resumeProcesses := os.Difference(ns)
if resumeProcesses.Len() != 0 {
props := &autoscaling.ScalingProcessQuery{
AutoScalingGroupName: aws.String(d.Id()),
ScalingProcesses: expandStringList(resumeProcesses.List()),
}
_, err := conn.ResumeProcesses(props)
if err != nil {
return fmt.Errorf("Error Resuming Processes for ASG %q: %s", d.Id(), err)
}
}
suspendedProcesses := ns.Difference(os)
if suspendedProcesses.Len() != 0 {
props := &autoscaling.ScalingProcessQuery{
AutoScalingGroupName: aws.String(d.Id()),
ScalingProcesses: expandStringList(suspendedProcesses.List()),
}
_, err := conn.SuspendProcesses(props)
if err != nil {
return fmt.Errorf("Error Suspending Processes for ASG %q: %s", d.Id(), err)
}
}
return nil
}