use of com.arm.mbed.cloud.sdk.internal.iam.model.TrustedCertificateRespList in project mbed-cloud-sdk-java by ARMmbed.
the class Certificates method listCertificates.
/**
* Lists all certificates according to filter options.
* <p>
* Note: This method returns only partially complete certificate objects.
* <p>
* In order to see the full information about a particular certificate, use {@link #getCertificate(String)} instead.
* <p>
* Example:
*
* <pre>
* {@code
* try {
* CertificateListOptions options = new CertificateListOptions();
* String ownerId = "015f4ac587f500000000000100100249";
* options.setOwnerIdFilter(ownerId);
* options.setTypeFilter(CertificateType.DEVELOPER);
*
* ListResponse<Certificate> certificates = certificateApi.listCertificates(options);
* for (Certificate certificate : certificates) {
* System.out.println("Certificate name: " + certificate.getName());
* System.out.println("Certificate server URI: " + certificate.getServerUri());
* }
* } catch (MbedCloudException e) {
* e.printStackTrace();
* }
* }
* </pre>
*
* @param options
* filter options.
* @return The list of certificates corresponding to filter options (One page).
* @throws MbedCloudException
* if a problem occurred during request processing.
*/
@API
@Nullable
public ListResponse<Certificate> listCertificates(@Nullable CertificateListOptions options) throws MbedCloudException {
final CertificateListOptions finalOptions = (options == null) ? new CertificateListOptions() : options;
final String serviceEq = finalOptions.getTypeFilter() == CertificateType.DEVELOPER ? CertificateType.BOOTSTRAP.toString() : finalOptions.encodeSingleEqualFilter(CertificateListOptions.TYPE_FILTER);
return CloudCaller.call(this, "listCertificates()", CertificateAdapter.getListMapper(), new CloudCall<TrustedCertificateRespList>() {
@Override
public Call<TrustedCertificateRespList> call() {
return endpoint.getAccountDeveloper().getAllCertificates(finalOptions.getLimit(), finalOptions.getAfter(), finalOptions.getOrder().toString(), finalOptions.encodeInclude(), finalOptions.encodeSingleEqualFilter(CertificateListOptions.NAME_FILTER), serviceEq, TranslationUtils.convertToInteger(finalOptions.encodeSingleEqualFilter(CertificateListOptions.EXPIRES_FILTER), null), finalOptions.getExecutionModeFilter(), finalOptions.getExecutionModeNotEqualFilter(), finalOptions.encodeSingleEqualFilter(CertificateListOptions.OWNER_ID_FILTER), finalOptions.getEnrollmentFilter(), finalOptions.encodeSingleLikeFilter(CertificateListOptions.ISSUER_FILTER), finalOptions.encodeSingleLikeFilter(CertificateListOptions.SUBJECT_FILTER));
}
});
}
use of com.arm.mbed.cloud.sdk.internal.iam.model.TrustedCertificateRespList in project mbed-cloud-sdk-java by ARMmbed.
the class CertificateAdapter method mapList.
/**
* Maps list of certificates.
*
* @param list
* certificate list to map.
* @return a list of mapped certificates.
*/
public static ListResponse<Certificate> mapList(TrustedCertificateRespList list) {
final TrustedCertificateRespList certificateList = list;
final RespList<TrustedCertificateResp> respList = new RespList<TrustedCertificateResp>() {
@Override
public Boolean getHasMore() {
return (certificateList == null) ? null : certificateList.isHasMore();
}
@Override
public Integer getTotalCount() {
return (certificateList == null) ? null : certificateList.getTotalCount();
}
@Override
public String getAfter() {
return (certificateList == null) ? null : certificateList.getAfter();
}
@Override
public Integer getLimit() {
return (certificateList == null) ? null : certificateList.getLimit();
}
@Override
public String getOrder() {
return (certificateList == null) ? null : certificateList.getOrder().toString();
}
@Override
public List<TrustedCertificateResp> getData() {
return (certificateList == null) ? null : certificateList.getData();
}
};
return GenericAdapter.mapList(respList, getMapper());
}
Aggregations