Deleting a Job Template
Sample Code
You can use the API to delete a template. A template used by jobs can also be deleted. Sample code is as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 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.
Long templateId = 789L; // Long |
try {
JobTemplateDeleteResponse result = apiInstance.deleteJobTemplate(xProjectId, templateId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling TemplateApi#deleteJobTemplate");
System.err.println(e.getResponseBody());
e.printStackTrace();
}
|
Parameter Description
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| xProjectId | Yes | String | Project ID. This parameter is used to obtain the token for the project. |
| templateId | Yes | Integer | Template ID. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| messageId | No | String | Message type ID. |
| message | No | String | Message content. |
| currentTime | No | Integer | Current time, expressed by milliseconds. |
| payload | No | - | For details about parameter types, see Table 3. |
Last Article: Querying the Job Template List
Next Article: Mapping between API & SDK (Java)
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.