Java 类com.amazonaws.services.ec2.model.ProductCode 实例源码

项目:clouck    文件:Ec2WrapperImpl.java   
@Override
public List<AbstractResource<?>> describeVolumes(Account account, Region region, DateTime dt, Ec2Filter... filters) {
    AmazonEC2 ec2 = findClient(account, region);

    DescribeVolumesRequest req = new DescribeVolumesRequest();
    for (Ec2Filter filter : filters) {
        Filter f = new Filter().withName(filter.getName()).withValues(filter.getValues());
        req.withFilters(f);
    }
    log.debug("start describing volumes for account:{} in region:{} via api", account.getId() + "=>" + account.getName(), region);
    DescribeVolumesResult res = ec2.describeVolumes(req);

    List<Boolean> autoEnableIOs = new ArrayList<>();
    List<List<ProductCode>> productCodes = new ArrayList<>();
    for (Volume volume : res.getVolumes()) {
        autoEnableIOs.add(findAutoEnableIO(account, region, volume.getVolumeId()));
        productCodes.add(findProductCodes(account, region, volume.getVolumeId()));
    }

    return converter.toEc2Volumes(res.getVolumes(), autoEnableIOs, productCodes, account.getId(), region, dt);
}
项目:clouck    文件:Ec2WrapperImpl.java   
@Override
public List<AbstractResource<?>> describeSnapshots(Account account, Region region, DateTime dt, Ec2Filter... filters) {
    AmazonEC2 ec2 = findClient(account, region);

    DescribeSnapshotsRequest req = new DescribeSnapshotsRequest();
    for (Ec2Filter filter : filters) {
        Filter f = new Filter().withName(filter.getName()).withValues(filter.getValues());
        req.withFilters(f);
    }

    log.debug("start describing snapshots for account:{} in region:{} via api", account.getId() + "=>" + account.getName(), region);
    DescribeSnapshotsResult res = ec2.describeSnapshots(req);

    List<List<CreateVolumePermission>> createVolumePermissions = new ArrayList<>();
    List<List<ProductCode>> productCodes = new ArrayList<>();
    for (Snapshot snapShot : res.getSnapshots()) {
        productCodes.add(findSnapshotProductCodes(account, region, snapShot.getSnapshotId()));
        createVolumePermissions.add(findCreateVolumePermissions(account, region, snapShot.getSnapshotId()));
    }

    return converter.toEc2Snapshots(res.getSnapshots(), createVolumePermissions, productCodes, account.getId(), region, dt);
}
项目:primecloud-controller    文件:ProductCodeConverter.java   
@Override
protected ProductCode convertObject(String from) {
    ProductCode to = new ProductCode();

    to.setProductCodeId(from);

    return to;
}
项目:clouck    文件:Ec2Converter.java   
public List<AbstractResource<?>> toEc2Volumes(List<Volume> volumes, List<Boolean> autoEnableIOs, List<List<ProductCode>> productCodes, String accountId, Region region, DateTime dt) {
    List<AbstractResource<?>> resources = new ArrayList<>();
    for (int i = 0; i < volumes.size(); i++) {
        Ec2Volume ec2Volume = new Ec2Volume();
        ec2Volume.setAutoEnableIO(autoEnableIOs.get(i));
        ec2Volume.setProductCodes(productCodes.get(i));
        conf(ec2Volume, accountId, region, dt);
        ec2Volume.setResource(volumes.get(i));
        resources.add(ec2Volume);
    }
    log.debug("{} volumes found via api and converted to Ec2Volume", resources.size());
    return resources;
}
项目:clouck    文件:Ec2Converter.java   
public List<AbstractResource<?>> toEc2Snapshots(List<Snapshot> snapshots, List<List<CreateVolumePermission>> createVolumePermissions, List<List<ProductCode>> productCodes, String accountId, Region region, DateTime dt) {
    List<AbstractResource<?>> resources = new ArrayList<>();
    for (int i = 0; i < snapshots.size(); i++) {
        Ec2Snapshot ec2Snapshot = new Ec2Snapshot();
        conf(ec2Snapshot, accountId, region, dt);
        ec2Snapshot.setResource(snapshots.get(i));
        ec2Snapshot.setCreateVolumePermissions(createVolumePermissions.get(i));
        ec2Snapshot.setProductCodes(productCodes.get(i));
        resources.add(ec2Snapshot);
    }
    log.debug("{} snapshots found via api and converted to Ec2Snapshot", resources.size());
    return resources;
}
项目:clouck    文件:Ec2WrapperImpl.java   
@Override
public List<ProductCode> findProductCodes(Account account, Region region, String volumeId) {
    AmazonEC2 ec2 = findClient(account, region);

    DescribeVolumeAttributeRequest req = new DescribeVolumeAttributeRequest();
    req.setVolumeId(volumeId);
    req.setAttribute("productCodes");

    log.debug("start describing volume attribute product codes for account:{} in region:{} via api", account.getId() + "=>" + account.getName(), region);
    return ec2.describeVolumeAttribute(req).getProductCodes();
}
项目:clouck    文件:Ec2WrapperImpl.java   
@Override
public List<ProductCode> findSnapshotProductCodes(Account account, Region region, String snapshotId) {
    AmazonEC2 ec2 = findClient(account, region);

    DescribeSnapshotAttributeRequest req = new DescribeSnapshotAttributeRequest();
    req.setAttribute("productCodes");
    req.setSnapshotId(snapshotId);

    log.debug("start describing snapshot productCodes for account:{} in region:{} via api", account.getId() + "=>" + account.getName(), region);
    DescribeSnapshotAttributeResult res = ec2.describeSnapshotAttribute(req);

    return res.getProductCodes();
}
项目:aws-sdk-java-resources    文件:ImageImpl.java   
@Override
public List<ProductCode> getProductCodes() {
    return (List<ProductCode>) resource.getAttribute("ProductCodes");
}
项目:aws-sdk-java-resources    文件:InstanceImpl.java   
@Override
public List<ProductCode> getProductCodes() {
    return (List<ProductCode>) resource.getAttribute("ProductCodes");
}
项目:clouck    文件:Ec2Volume.java   
public List<ProductCode> getProductCodes() {
    return productCodes;
}
项目:clouck    文件:Ec2Volume.java   
public void setProductCodes(List<ProductCode> productCodes) {
    this.productCodes = productCodes;
}
项目:clouck    文件:Ec2Snapshot.java   
public List<ProductCode> getProductCodes() {
    return productCodes;
}
项目:clouck    文件:Ec2Snapshot.java   
public void setProductCodes(List<ProductCode> productCodes) {
    this.productCodes = productCodes;
}
项目:clouck    文件:ProductCodeComparator.java   
@Override
public int compare(ProductCode p1, ProductCode p2) {
    return new CompareToBuilder().append(p1.getProductCodeId(), p2.getProductCodeId()).toComparison();
}
项目:aws-sdk-java-resources    文件:Instance.java   
/**
 * Gets the value of the ProductCodes attribute. If this resource is not yet
 * loaded, a call to {@code load()} is made to retrieve the value of the
 * attribute.
 */
List<ProductCode> getProductCodes();
项目:aws-sdk-java-resources    文件:Image.java   
/**
 * Gets the value of the ProductCodes attribute. If this resource is not yet
 * loaded, a call to {@code load()} is made to retrieve the value of the
 * attribute.
 */
List<ProductCode> getProductCodes();
项目:clouck    文件:Ec2Wrapper.java   
List<ProductCode> findProductCodes(Account account, Region region, String volumeId);
项目:clouck    文件:Ec2Wrapper.java   
List<ProductCode> findSnapshotProductCodes(Account account, Region region, String snapshotId);