All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.arm.mbed.cloud.sdk.billing.adapters.BillingReportAdapter Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 2.5.0
Show newest version
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);
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy