หน้านี้ยังไม่พร้อมใช้งานในภาษาท้องถิ่นของคุณ เรากำลังพยายามอย่างหนักเพื่อเพิ่มเวอร์ชันภาษาอื่น ๆ เพิ่มเติม ขอบคุณสำหรับการสนับสนุนเสมอมา
DataArts Lake Formation
DataArts Lake Formation
- What's New
- Function Overview
- Service Overview
- Getting Started
- User Guide
- Best Practices
- Developer Guide
-
API Reference
- Before You Start
- API Overview
- API Calling
-
API
-
Console
- Instance Management
- Job Management
-
Service Authorization Management
- Granting Permissions for Accessing Other Cloud Services
- Querying Cloud Service Access Permissions
- Registering a Tenant Agreement
- Querying whether a Tenant Has Registered an Agreement
- Deleting a Tenant Agreement
- Registering a Tenant Agreement
- Querying whether a Tenant Has Registered an Agreement
- Deleting a Tenant Agreement
- Querying the Current System Agreement
- OBS Management
- Access Management
- Specification Management
- Quota Management Service
- Tag Management Service
- Agency Management
- Alarm Management
- Metadata Management
- Location
-
LakeCat
- Function Management
- Catalog Management
- Database Management
- Table Management
- Data Table Statistics
- Zone-based Management
- Partition Statistics
- Authorization Management
- User Group Management
- Metadata Statistics
-
Role Management
- Creating a Role
- Listing Roles on Different Pages by Condition
- Deleting a Role
- Obtaining a Role
- Modifying a Role
- Listing All Role Names
- Querying the Users or User groups Under a Role
- Adding One or More Users or User Groups to a Role
- Removing One or More Users or User Groups from a Role
- Updating the Entities in a Role
- Credential Management
- Configuration Management
- User
-
Console
- Application Examples
- Permissions and Supported Actions
- Appendix
- FAQs
- General Reference
On this page
Show all
Help Center/
DataArts Lake Formation/
Developer Guide/
Using LakeFormation Java SDK to Develop Programs/
Reference Example
Copied.
Reference Example
After the development and running environments are prepared, you can develop samples as required.
The following is an example of using LakeFormation Java SDK to develop programs:
(The following code describes how to initialize the SDK, create a LakeFormationClient instance, create a request, add parameters, and query the catalog list.)
package com.huawei.cloud.dalf.lakecat.examples; import com.huaweicloud.sdk.core.auth.BasicCredentials; import com.huaweicloud.sdk.core.exception.ClientRequestException; import com.huaweicloud.sdk.core.exception.ServerResponseException; import com.huaweicloud.sdk.core.http.HttpConfig; import com.huaweicloud.sdk.lakeformation.v1.LakeFormationClient; import com.huaweicloud.sdk.lakeformation.v1.model.ListCatalogsRequest; import com.huaweicloud.sdk.lakeformation.v1.model.ListCatalogsResponse; import java.util.ArrayList; import java.util.List; public class LakeFormationExample { public static void main(String[] args) { // The getAk() and getSk() methods need to be implemented by yourself. You can obtain the AK/SK from the configuration item or other locations. // Do not hard-code AK and SK in codes. String ak = getAk(); String sk = getSk(); // projectId: project ID String projectId = "{******your project id******}"; // 1. Initialize the SDK. HttpConfig config = HttpConfig.getDefaultHttpConfig(); config.withIgnoreSSLVerification(true); List<String> endpoints = new ArrayList<>(); endpoints.add("lakeformation.lakecat.com"); BasicCredentials basicCredentials = new BasicCredentials().withAk(ak).withSk(sk).withProjectId(projectId); // 2. Create a LakeFormationClient instance. LakeFormationClient client = LakeFormationClient.newBuilder() .withHttpConfig(config) .withCredential(basicCredentials) .withEndpoints(endpoints) .build(); // 3. Create a request and add parameters. ListCatalogsRequest listCatalogsRequest = new ListCatalogsRequest().withInstanceId("{******your instance id******}"); // 4. Query the catalog list. try { ListCatalogsResponse response = client.listCatalogs(listCatalogsRequest); System.out.println(response.getHttpStatusCode()); System.out.println(response); } catch (ClientRequestException | ServerResponseException e) { System.out.println(e.getHttpStatusCode()); System.out.println(e.getMessage()); } } }
Parent topic: Using LakeFormation Java SDK to Develop Programs
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot