SDKs Related to Flink Job Templates
Prerequisites
- You have configured the Java SDK environment by following the instructions provided Instructions.
- You have initialized the DLI Client by following the instructions provided in Initializing the DLI Client.
Creating a Job Template
DLI provides an API for creating a Flink job template. The example code is as follows:
1 2 3 4 5 6 |
public static void createFlinkJobTemplate(DLIClient client) throws DLIException{ CreateFlinkJobTemplateRequest body = new CreateFlinkJobTemplateRequest(); body.name("template"); FlinkJobTemplateCreateResponse result = client.createFlinkJobTemplate(body); System.out.println(result); } |
Updating a Job Template
DLI provides an API for updating a Flink job template. The example code is as follows:
1 2 3 4 5 6 7 |
public static void updateFlinkJobTemplate(DLIClient client) throws DLIException{ Long templateId = 277L; //Template ID UpdateFlinkJobTemplateRequest body = new UpdateFlinkJobTemplateRequest(); body.name("template-update"); GlobalResponse result = client.updateFlinkJobTemplate(body,templateId); System.out.println(result); } |
Deleting a Job Template
DLI provides an API for deleting a Flink job template. A template used by jobs can also be deleted. The example code is as follows:
1 2 3 4 5 |
public static void deleteFlinkJobTemplate(DLIClient client) throws DLIException{ Long templateId = 277L; //Template ID FlinkJobTemplateDeleteResponse result = client.deleteFlinkJobTemplate(templateId); System.out.println(result); } |
Querying the List of Job Templates
DLI provides an API for querying Flink job templates. In this example, the query results are displayed in descending order and information about the job templates whose IDs are less than the value of cursor is displayed. The example code is as follows:
1 2 3 4 5 6 7 |
public static void getFlinkJobTemplates(DLIClient client) throws DLIException{ Long offset = 789L; // Long | Template offset. Integer limit = 56; // Integer | Maximum number of records that can be queried. String order = "asc"; // String | Query result display. The query results can be displayed in ascending or descending order. FlinkJobTemplateListResponse result = client.getFlinkJobTemplates(offset,limit,order); System.out.println(result); } |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.