更新时间:2024-04-17 GMT+08:00
初始化GES管理面客户端
使用GES SDK工具访问GES管理面,需要用户初始化GES客户端。用户可以使用AK/SK(Access Key ID/Secret Access Key)或Token两种认证方式初始化客户端,示例代码如下:
- AK/SK认证方式样例代码
String ak = "ak"; String sk = "sk"; String regionName = "regionname"; String projectId = "project_id"; GesInfo gesInfo = new GesInfo(regionName, ak, sk, projectId); gesInfo.setIamEndpoint("iam_endpoint"); gesInfo.setGesEndpoint("ges_endpoint"); GesClient client = new GesClient(AuthenticationMode.AKSK, gesInfo);
- Token认证方式样例代码
String domainName = "domainname"; String userName = "username"; String password = "password"; String regionName = "regionname"; String projectId = "project_id"; GesInfo gesInfo = new GesInfo(regionName, domainName, userName, password, projectId); gesInfo.setIamEndpoint("iam_endpoint"); gesInfo.setGesEndpoint("ges_endpoint"); GesClient client = new GesClient(AuthenticationMode.TOKEN, gesInfo);
父主题: 使用管理面SDK