com.arm.mbed.cloud.sdk.billing.adapters.BillingReportAdapter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mbed-cloud-sdk Show documentation
Show all versions of mbed-cloud-sdk Show documentation
The Pelion Cloud SDK (formerly known as Mbed Cloud SDK) provides a simplified interface to the Pelion Cloud APIs by exposing functionality using conventions and paradigms familiar to Java developers.
package com.arm.mbed.cloud.sdk.billing.adapters;
import java.net.MalformedURLException;
import com.arm.mbed.cloud.sdk.annotations.Internal;
import com.arm.mbed.cloud.sdk.annotations.Preamble;
import com.arm.mbed.cloud.sdk.common.FileDownload;
import com.arm.mbed.cloud.sdk.common.MbedCloudException;
import com.arm.mbed.cloud.sdk.lowlevel.pelionclouddevicemanagement.model.BillingReportRawDataResponse;
@Preamble(description = "Adapter for Billing reports")
@Internal
public final class BillingReportAdapter {
private BillingReportAdapter() {
super();
}
/**
* Maps billing reports.
*
* @param toBeMapped
* billing report from Pelion Cloud.
* @param destination
* destination path
* @return corresponding service package.
* @throws MbedCloudException
* if an error occurred during the process
*/
public static FileDownload map(BillingReportRawDataResponse toBeMapped,
String destination) throws MbedCloudException {
if (toBeMapped == null) {
return null;
}
try {
return new FileDownload(toBeMapped.getUrl(), destination, toBeMapped.getFilename());
} catch (MalformedURLException exception) {
throw new MbedCloudException(exception);
}
}
}