You need to enable JavaScript to run this app.
导航

删除伸缩组

最近更新时间2023.07.19 17:54:47

首次发布时间2023.07.19 17:54:47

本文介绍如何删除伸缩组。

示例代码

package autoscalingexample

import (
	"fmt"

	"github.com/volcengine/volcengine-go-sdk/service/autoscaling"
	"github.com/volcengine/volcengine-go-sdk/volcengine"
	"github.com/volcengine/volcengine-go-sdk/volcengine/credentials"
	"github.com/volcengine/volcengine-go-sdk/volcengine/session"
)

func DeleteScalingGroup() {
	ak, sk, region := "Your AK", "Your SK", "cn-beijing"//设置您的ak、sk和要访问的地域(本例以北京地域为例)
	config := volcengine.NewConfig().
		WithRegion(region).
		WithCredentials(credentials.NewStaticCredentials(ak, sk, ""))
	sess, err := session.NewSession(config)
	if err != nil {
		panic(err)
	}
	svc := autoscaling.New(sess)
	
	//删除伸缩组
	deleteScalingGroupInput := &autoscaling.DeleteScalingGroupInput{
		ScalingGroupId: volcengine.String("scg-ybmssdnnhn5pkgyd****"),//伸缩组ID
	}


	// 发起请求并处理返回或异常
	resp, err := svc.DeleteScalingGroup(deleteScalingGroupInput)
	if err != nil {
		panic(err)
	}
	fmt.Println(resp)
}

相关文档