Example usage for com.amazonaws.services.ec2.model Image getProductCodes

List of usage examples for com.amazonaws.services.ec2.model Image getProductCodes

Introduction

In this page you can find the example usage for com.amazonaws.services.ec2.model Image getProductCodes.

Prototype


public java.util.List<ProductCode> getProductCodes() 

Source Link

Document

Any product codes associated with the AMI.

Usage

From source file:org.gridgain.grid.spi.cloud.ec2lite.GridEc2LiteCloudSpi.java

License:GNU General Public License

/**
 * Gets image resource from EC2 image./*from  w w  w.  ja v a2 s .  c  o m*/
 *
 * @param img EC2 image.
 * @return Image resource.
 */
private GridCloudSpiResourceAdapter createImageResource(Image img) {
    assert img != null;

    Map<String, String> params = new HashMap<String, String>();

    params.put(IMG_ARCH, img.getArchitecture());
    params.put(IMG_LOC, img.getImageLocation());
    params.put(IMG_STATE, img.getState());
    params.put(INST_TYPE, img.getImageType());
    params.put(IMG_KERNEL_ID, img.getKernelId());
    params.put(OWNER_ID, img.getOwnerId());
    params.put(INST_PLATFORM, img.getPlatform());
    params.put(IMG_RAMDISK_ID, img.getRamdiskId());
    params.put(IMG_PUBLIC, String.valueOf(img.isPublic()));

    params.put(PRODUCT_CODE_IDS, F.concat(F.transform(img.getProductCodes(), new C1<ProductCode, String>() {
        @Override
        public String apply(ProductCode e) {
            return e.getProductCodeId();
        }
    }), VAL_DELIM));

    return new GridCloudSpiResourceAdapter(img.getImageId(), CLD_IMAGE, cloudId, params);
}