Updating a Job Template

Sample Code

You can use the API to update a job template. Sample code is as follows:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
// Import classes:
import com.huaweicloud.cs.java.v1.client.ApiException;
import com.huaweicloud.cs.java.v1.TemplateApi;


TemplateApi apiInstance = new TemplateApi(apiClient);//apiClient is created when initializing a CS API client.
String xProjectId = "xProjectId_example"; // String | Project ID used for obtaining the token for the project.
UpdateJobTemplateRequest body = new UpdateJobTemplateRequest(); // UpdateJobTemplateRequest | Submit the request for modifying the SQL job template.
try {
    JobTemplateUpdateResponse result = apiInstance.updateJobTemplate(xProjectId, body);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling TemplateApi#updateJobTemplate");
    System.err.println(e.getResponseBody());
    e.printStackTrace();
}

Parameters

Table 1 Parameters

Parameter

Mandatory

Type

Description

xProjectId

Yes

String

Project ID. This parameter is used to obtain the token for the project.

body

Yes

-

Whether to submit a request for modifying the SQL job template. For details about parameter types, see Table 2.

Table 2 Parameters involved in UpdateJobTemplateRequest

Parameter

Mandatory

Type

Description

id

Yes

Integer

Template ID.

name

No

String

Template name.

desc

No

String

Template description.

sqlBody

No

String

Stream SQL statement, which includes at least the following three parts: source, query, and sink.

tags

No

String

Template tag.

Table 3 Parameters involved in JobTemplateUpdateResponse

Parameter

Mandatory

Type

Description

messageId

No

String

Message type ID.

message

No

String

Message content.

currentTime

No

Integer

Current time, expressed by milliseconds.