Resource-Related SDKs
Uploading a Resource Package
You can use the interface provided by the DLI to upload resource packages. The code example is as follows:
1 2 3 4 5 6 7 8 9 | private static void uploadResources(DLIClient client) throws DLIException {
String kind = "jar";
String[] paths = new String[1];
paths[0] = "https://bucketname.obs.cn-north-1.myhuaweicloud.com/jarname.jar";
String description = "test for sdk";
//Call the uploadResources method of the DLIClient object to upload resources.
List<PackageResource> packageResources = client.uploadResources(kind, paths, description);
System.out.println("---------- uploadResources success ---------");
}
|
The paths parameter consists of {bucketName}.{OBS domain name}/{jarPath}/{jarName}.
Querying All Resource Packages
You can use the API provided by DLI to query the list of uploaded resources. Sample code is as follows:
1 2 3 4 5 6 7 8 9 10 11 | private static void listAllResources(DLIClient client) throws DLIException {
System.out.println("list all resources...");
//Call the listAllResources method of the DLIClient object to query the queue resource list.
Resources resources = client.listAllResources();
for (PackageResource packageResource : resources.getPackageResources()) {
System.out.println("Package resource name:" + packageResource.getResourceName());
}
for (ModuleResource moduleResource : resources.getModuleResources()) {
System.out.println("Module resource name:" + moduleResource.getModuleName());
}
}
|
Last Article: Queue-Related SDKs
Next Article: SDKs Related to SQL Jobs
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.