Help Center/ Data Warehouse Service/ API Reference/ API Description/ Logical Cluster Management/ Adding a Scheduled Plan for Adding or Deleting a Logical Cluster
Updated on 2026-06-22 GMT+08:00

Adding a Scheduled Plan for Adding or Deleting a Logical Cluster

Function

This API is used to add a scheduled plan for adding or deleting a logical cluster.

Calling Method

For details, see Calling APIs.

URI

POST /v1/{project_id}/clusters/{cluster_id}/logical-cluster-plans

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

cluster_id

Yes

String

Definition

Cluster ID. For details about how to obtain the value, see Obtaining the Cluster ID.

Constraints

N/A

Range

N/A

Default Value

N/A

project_id

Yes

String

Definition

Project ID. To obtain the value, see Obtaining a Project ID.

Constraints

N/A

Range

N/A

Default Value

N/A

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

logical_cluster_name

No

String

Definition

Logical cluster name.

Constraints

N/A

Range

N/A

Default Value

N/A

user

No

String

Definition

User bound to the logical cluster. If the primary logical cluster has been bound, a user cannot be bound.

Constraints

N/A

Range

N/A

Default Value

N/A

node_num

No

Integer

Definition

Number of nodes in the logical cluster.

Constraints

N/A

Range

N/A

Default Value

N/A

main_logical_cluster

No

String

Definition

Primary logical cluster bound to the logical cluster. If a user is bound, the primary logical cluster cannot be bound.

Constraints

N/A

Range

N/A

Default Value

N/A

plan_type

Yes

String

Definition

Plan type. The value can be once or periodicity.

Constraints

N/A

Range

once: one-off plan

periodicity: periodic plan

Default Value

N/A

start_time

No

String

Definition

Start time of the scheduled plan for adding or deleting a logic cluster.

Constraints

N/A

Range

N/A

Default Value

N/A

end_time

No

String

Definition

End time of the scheduled plan for adding or deleting a logic cluster.

Constraints

N/A

Range

N/A

Default Value

N/A

actions

Yes

Array of LogicalClusterPlanActionsParam objects

Definition

Details of the scheduled plan for adding or deleting a logic cluster.

Constraints

N/A

Range

N/A

Default Value

N/A

Table 3 LogicalClusterPlanActionsParam

Parameter

Mandatory

Type

Description

type

Yes

String

Definition

Type. The value can be create or delete.

Constraints

N/A

Range

create

delete

Default Value

N/A

strategy

No

String

Definition

The time and date for the task to run. Cron policy expression: for example, "0 0 0? * 3".

Constraints

N/A

Range

N/A

Default Value

N/A

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

plan_id

String

Definition

ID of the plan for adding or deleting a logical cluster.

Range

N/A

Example Requests

Add a scheduled plan for adding or deleting a logical cluster.

POST https://{Endpoint}/v1/89cd04f168b84af6be287f71730fdb4b/clusters/4ca46bf1-5c61-48ff-b4f3-0ad4e5e3ba90/logical-cluster-plans

{
  "logical_cluster_name" : "LC_0218",
  "node_num" : 3,
  "plan_type" : "once",
  "user" : "",
  "actions" : [ {
    "type" : "delete",
    "strategy" : 1740037020000
  } ],
  "main_logical_cluster" : null
}

Example Responses

Status code: 200

Scheduled plan for adding or deleting a logical cluster added.

{
  "plan_id" : "03eaf309-2d91-4b28-a93c-0a45980d3192"
}

SDK Sample Code

The SDK sample code is as follows.

Add a scheduled plan for adding or deleting a logical cluster.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package com.huaweicloud.sdk.test;

import com.huaweicloud.sdk.core.auth.ICredential;
import com.huaweicloud.sdk.core.auth.BasicCredentials;
import com.huaweicloud.sdk.core.exception.ConnectionException;
import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
import com.huaweicloud.sdk.core.exception.ServiceResponseException;
import com.huaweicloud.sdk.dws.v2.region.DwsRegion;
import com.huaweicloud.sdk.dws.v2.*;
import com.huaweicloud.sdk.dws.v2.model.*;

import java.util.List;
import java.util.ArrayList;

public class CreateLogicalClusterPlanSolution {

    public static void main(String[] args) {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        String ak = System.getenv("CLOUD_SDK_AK");
        String sk = System.getenv("CLOUD_SDK_SK");
        String projectId = "{project_id}";

        ICredential auth = new BasicCredentials()
                .withProjectId(projectId)
                .withAk(ak)
                .withSk(sk);

        DwsClient client = DwsClient.newBuilder()
                .withCredential(auth)
                .withRegion(DwsRegion.valueOf("<YOUR REGION>"))
                .build();
        CreateLogicalClusterPlanRequest request = new CreateLogicalClusterPlanRequest();
        request.withClusterId("{cluster_id}");
        LogicalClusterPlanBo body = new LogicalClusterPlanBo();
        List<LogicalClusterPlanActionsParam> listbodyActions = new ArrayList<>();
        listbodyActions.add(
            new LogicalClusterPlanActionsParam()
                .withType("delete")
                .withStrategy("1740037020000")
        );
        body.withActions(listbodyActions);
        body.withPlanType("once");
        body.withNodeNum(3);
        body.withUser("");
        body.withLogicalClusterName("LC_0218");
        request.withBody(body);
        try {
            CreateLogicalClusterPlanResponse response = client.createLogicalClusterPlan(request);
            System.out.println(response.toString());
        } catch (ConnectionException e) {
            e.printStackTrace();
        } catch (RequestTimeoutException e) {
            e.printStackTrace();
        } catch (ServiceResponseException e) {
            e.printStackTrace();
            System.out.println(e.getHttpStatusCode());
            System.out.println(e.getRequestId());
            System.out.println(e.getErrorCode());
            System.out.println(e.getErrorMsg());
        }
    }
}

Add a scheduled plan for adding or deleting a logical cluster.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkdws.v2.region.dws_region import DwsRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkdws.v2 import *

if __name__ == "__main__":
    # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak = os.environ["CLOUD_SDK_AK"]
    sk = os.environ["CLOUD_SDK_SK"]
    projectId = "{project_id}"

    credentials = BasicCredentials(ak, sk, projectId)

    client = DwsClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(DwsRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = CreateLogicalClusterPlanRequest()
        request.cluster_id = "{cluster_id}"
        listActionsbody = [
            LogicalClusterPlanActionsParam(
                type="delete",
                strategy="1740037020000"
            )
        ]
        request.body = LogicalClusterPlanBo(
            actions=listActionsbody,
            plan_type="once",
            node_num=3,
            user="",
            logical_cluster_name="LC_0218"
        )
        response = client.create_logical_cluster_plan(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)

Add a scheduled plan for adding or deleting a logical cluster.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    dws "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dws/v2"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dws/v2/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dws/v2/region"
)

func main() {
    // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak := os.Getenv("CLOUD_SDK_AK")
    sk := os.Getenv("CLOUD_SDK_SK")
    projectId := "{project_id}"

    auth := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        WithProjectId(projectId).
        Build()

    client := dws.NewDwsClient(
        dws.DwsClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.CreateLogicalClusterPlanRequest{}
	request.ClusterId = "{cluster_id}"
	strategyActions:= "1740037020000"
	var listActionsbody = []model.LogicalClusterPlanActionsParam{
        {
            Type: "delete",
            Strategy: &strategyActions,
        },
    }
	nodeNumLogicalClusterPlanBo:= int32(3)
	userLogicalClusterPlanBo:= ""
	logicalClusterNameLogicalClusterPlanBo:= "LC_0218"
	request.Body = &model.LogicalClusterPlanBo{
		Actions: listActionsbody,
		PlanType: "once",
		NodeNum: &nodeNumLogicalClusterPlanBo,
		User: &userLogicalClusterPlanBo,
		LogicalClusterName: &logicalClusterNameLogicalClusterPlanBo,
	}
	response, err := client.CreateLogicalClusterPlan(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.

Status Codes

Status Code

Description

200

Scheduled plan for adding or deleting a logical cluster added.

400

Request error.

401

Authentication failed.

403

You do not have required permissions.

404

No resources found.

500

Internal server error.

503

Service unavailable.