package com.envisioniot.enos.api.sample.connect_service.cert;
import com.envision.apim.poseidon.config.PConfig;
import com.envision.apim.poseidon.core.Poseidon;
import com.envisioniot.enos.connect_service.v2_1.cert.ListCertificatesRequest;
import com.envisioniot.enos.connect_service.v2_1.cert.ListCertificatesResponse;
import com.envisioniot.enos.connect_service.vo.CertificateInfo;
import com.envisioniot.enos.connect_service.vo.DeviceIdentifier;
import java.util.List;
public class ListCert {
public static void main(String[] args) {
ListCertificatesRequest listCertificatesRequest = new ListCertificatesRequest();
String appKey = "e36cc693-3a07-456e6cafcbc2-9314-4ff6";
String appSecret = "6cafcbc2-9314-4ff6-9450-861d4344a431";
String serverUrl = "http://apim-apigw-proxy.alpha-k8s-cn4.eniot.io";
String orgId = "o15444172373271";
DeviceIdentifier device = new DeviceIdentifier();
// Either assetId or productKey + deviceKey is required.
device.setProductKey("ymcDiAHd");
device.setAssetId("KloXinjW");
device.setDeviceKey("TT6MyEFaO7");
listCertificatesRequest.setDevice(device);
listCertificatesRequest.setOrgId(orgId);
ListCertificatesResponse certRsp = Poseidon.config(PConfig.init().appKey(appKey).appSecret(appSecret).debug())
.url(serverUrl)
.getResponse(listCertificatesRequest, ListCertificatesResponse.class);
List<CertificateInfo> certificateInfos = certRsp.getData();
if (certificateInfos != null) {
for (CertificateInfo certificateInfo : certificateInfos) {
System.out.println(certificateInfo);
}
}
}
}