use of com.arm.mbed.cloud.sdk.internal.enrollment.model.EnrollmentIdentity in project mbed-cloud-sdk-java by ARMmbed.
the class EnrollmentAdapter method mapList.
/**
* Maps a list of enrollment identities.
*
* @param list
* enrollment identities (page).
* @return a list of enrollment identities
*/
public static ListResponse<EnrollmentClaim> mapList(EnrollmentIdentities list) {
final EnrollmentIdentities enrollmentList = list;
final RespList<EnrollmentIdentity> respList = new RespList<EnrollmentIdentity>() {
@Override
public Boolean getHasMore() {
return (enrollmentList == null) ? null : enrollmentList.isHasMore();
}
@Override
public Integer getTotalCount() {
return (enrollmentList == null) ? null : enrollmentList.getTotalCount();
}
@Override
public String getAfter() {
return (enrollmentList == null) ? null : enrollmentList.getAfter();
}
@Override
public Integer getLimit() {
return (enrollmentList == null) ? null : enrollmentList.getLimit();
}
@Override
public String getOrder() {
return (enrollmentList == null) ? null : enrollmentList.getOrder().toString();
}
@Override
public List<EnrollmentIdentity> getData() {
return (enrollmentList == null) ? null : enrollmentList.getData();
}
};
return GenericAdapter.mapList(respList, getMapper());
}
use of com.arm.mbed.cloud.sdk.internal.enrollment.model.EnrollmentIdentity in project mbed-cloud-sdk-java by ARMmbed.
the class Enrollment method addEnrollmentClaim.
/**
* Places an enrolment claim for one or several devices.
* <p>
* Example:
*
* <pre>
* {@code
* try {
* String claimId = "A-35:e7:72:8a:07:50:3b:3d:75:96:57:52:72:41:0d:78:cc:c6:e5:53:48:c6:65:58:5b:fa:af:4d:2d:73:95:c5";
* EnrollmentClaim claim = enrollmentApi.addEnrollmentClaim(claimId)
* System.out.println(claim);
*
* } catch (MbedCloudException e) {
* e.printStackTrace();
* }
* }
* </pre>
*
* @param claimId
* Claim Id. Pattern: '^[A-Z]{1}-[A-Za-z0-9:]{1, 256}' e.g.
* A-35:e7:72:8a:07:50:3b:3d:75:96:57:52:72:41:0d:78:cc:c6:e5:53:48:c6:65:58:5b:fa:af:4d:2d:73:95:c5
* @return enrollment claim.
* @throws MbedCloudException
* if a problem occurred during request processing.
*/
@API
@Nullable
public EnrollmentClaim addEnrollmentClaim(@NonNull String claimId) throws MbedCloudException {
checkNotNull(claimId, TAG_ENROLLMENT_ID);
final EnrollmentId finalEnrollmentId = new EnrollmentId().enrollmentIdentity(claimId);
return CloudCaller.call(this, "addEnrollmentClaim()", EnrollmentAdapter.getMapper(), new CloudCall<EnrollmentIdentity>() {
@Override
public Call<EnrollmentIdentity> call() {
return endpoint.getEnrollment().createDeviceEnrollment(finalEnrollmentId);
}
});
}
Aggregations