Deployment group
Updated at:2025-10-20
Create a deployment group
A deployment group can be created using the specified deployment group policy with the given code.
Go
1package main
2import (
3 "fmt"
4 "github.com/baidubce/bce-sdk-go/services/bcc"
5 "github.com/baidubce/bce-sdk-go/services/bcc/api"
6)
7func main() {
8 // Set your AK, SK and the endpoint to be accessed
9 ak := "ak"
10 sk := "sk"
11 endpoint := "bcc.bj.baidubce.com"
12 // Create a BCC client
13 bccClient, _ := bcc.NewClient(ak, sk, endpoint)
14
15 CreateDploySetArgs := &api.CreateDeploySetArgs{
16 // Deployment group policy, defaulting to HOST_HA
17 Strategy: "HOST_HA",
18 // Deployment group name
19 Name: "testDeploySetName",
20 // Deployment group description
21 Desc: "test Deploy Desc",
22 // Parallelism of deployment group
23 Concurrency: 2,
24 }
25 result, err := bccClient.CreateDeploySet(CreateDploySetArgs)
26 fmt.Println(err)
27 fmt.Println(result)
28}
Query the deployment group list
Use the following code to query the list and detailed information of all deployment group instances.
Go
1package main
2import (
3 "fmt"
4 "github.com/baidubce/bce-sdk-go/services/bcc"
5)
6func main() {
7 // Set your AK, SK and the endpoint to be accessed
8 ak := "ak"
9 sk := "sk"
10 endpoint := "bcc.bj.baidubce.com"
11 // Create a BCC client
12 bccClient, _ := bcc.NewClient(ak, sk, endpoint)
13 result, err := bccClient.ListDeploySets()
14 fmt.Println(err)
15 fmt.Println(result)
16}
Modify deployment group attributes
Use the following code to modify the attributes of a specified deployment group.
Go
1package main
2import (
3 "fmt"
4 "github.com/baidubce/bce-sdk-go/services/bcc"
5 "github.com/baidubce/bce-sdk-go/services/bcc/api"
6)
7func main() {
8 // Set your AK, SK and the endpoint to be accessed
9 ak := "ak"
10 sk := "sk"
11 endpoint := "bcc.bj.baidubce.com"
12 // Create a BCC client
13 bccClient, _ := bcc.NewClient(ak, sk, endpoint)
14 DeployId := "dset-***"
15 ModifyDeploySetName := "ModifyName"
16 ModifyDeployDesc := "Modify Desc"
17 queryArgs := &api.ModifyDeploySetArgs{
18 // Deployment group name
19 Name: ModifyDeploySetName,
20 // Deployment group description
21 Desc: ModifyDeployDesc,
22 }
23 result, err := bccClient.ModifyDeploySet(DeployId, queryArgs)
24 fmt.Println(err)
25 fmt.Println(result)
26}
Delete a specified deployment group
Use the following code to delete a specified deployment group.
Go
1package main
2import (
3 "fmt"
4 "github.com/baidubce/bce-sdk-go/services/bcc"
5)
6func main() {
7 // Set your AK, SK and the endpoint to be accessed
8 ak := "ak"
9 sk := "sk"
10 endpoint := "bcc.bj.baidubce.com"
11 // Create a BCC client
12 bccClient, _ := bcc.NewClient(ak, sk, endpoint)
13
14 DeployId := "dset-***"
15 result := bccClient.DeleteDeploySet(DeployId)
16 fmt.Println(result)
17}
Bind a specified deployment group
Use the following code to bind a deployment group that you specify.
Go
1 queryArgs := &api.UpdateInstanceDeployArgs{
2 // Set InstanceId to be bound
3 InstanceId: "InstanceId",
4 // Set DeploySetIds to be bound
5 DeploySetIds: []string{"DeploySetId"},
6 }
7 rep, err := BCC_CLIENT.UpdateInstanceDeploySet(queryArgs)
8 fmt.Println(rep)
9 ExpectEqual(t.Errorf, err, nil)
Unbind a specified deployment group
Use the following code to unbind a deployment group that you specify.
Go
1 queryArgs := &api.DelInstanceDeployArgs{
2 // Set DeploySetId to be unbound
3 DeploySetId: "DeploySetId",
4 // Set InstanceIds to be unbound
5 InstanceIds: []string{"InstanceId"},
6 }
7 rep, err := BCC_CLIENT.DelInstanceDeploySet(queryArgs)
8 fmt.Println(rep)
9 ExpectEqual(t.Errorf, err, nil)
