当前位置: 首页>>代码示例>>Java>>正文


Java CreateVolumeRequest类代码示例

本文整理汇总了Java中com.amazonaws.services.ec2.model.CreateVolumeRequest的典型用法代码示例。如果您正苦于以下问题:Java CreateVolumeRequest类的具体用法?Java CreateVolumeRequest怎么用?Java CreateVolumeRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CreateVolumeRequest类属于com.amazonaws.services.ec2.model包,在下文中一共展示了CreateVolumeRequest类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createVolume

import com.amazonaws.services.ec2.model.CreateVolumeRequest; //导入依赖的package包/类
/**
 * Creates a volume and return the volume id.
 */
public static String createVolume(VerificationHost host, AmazonEC2Client client) {
    CreateVolumeRequest req = new CreateVolumeRequest()
            .withAvailabilityZone(zoneId + avalabilityZoneIdentifier)
            .withSize(1);
    CreateVolumeResult res = client.createVolume(req);
    String volumeId = res.getVolume().getVolumeId();
    Filter filter = new Filter().withName(VOLUME_ID_ATTRIBUTE).withValues(volumeId);

    DescribeVolumesRequest volumesRequest = new DescribeVolumesRequest()
            .withVolumeIds(volumeId)
            .withFilters(filter);

    host.waitFor("Timeout waiting for creating volume", () -> {
        DescribeVolumesResult volumesResult = client.describeVolumes(volumesRequest);
        String state = volumesResult.getVolumes().get(0).getState();
        if (state.equalsIgnoreCase(VOLUME_STATUS_AVAILABLE)) {
            return true;
        }
        return false;
    });
    return volumeId;
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:26,代码来源:TestAWSSetupUtils.java

示例2: createVolume

import com.amazonaws.services.ec2.model.CreateVolumeRequest; //导入依赖的package包/类
/**
 * Creates volume for EBS.
 * @return volume ID of newly created volume
 */
private String createVolume(String storageId, String snapshotId, int size) {
	String volumeType = Ec2IaasHandler.findStorageProperty(this.targetProperties, storageId, VOLUME_TYPE_PREFIX);
	if(volumeType == null) volumeType = "standard";

	CreateVolumeRequest createVolumeRequest = new CreateVolumeRequest()
			.withAvailabilityZone( this.availabilityZone )
			.withVolumeType( volumeType )
			.withSize( size ); // The size of the volume, in gigabytes.

	// EC2 snapshot IDs start with "snap-"...
	if(! Utils.isEmptyOrWhitespaces(snapshotId) && snapshotId.startsWith("snap-"))
		createVolumeRequest.withSnapshotId(snapshotId);

	CreateVolumeResult createVolumeResult = this.ec2Api.createVolume(createVolumeRequest);
	return createVolumeResult.getVolume().getVolumeId();
}
 
开发者ID:roboconf,项目名称:roboconf-platform,代码行数:21,代码来源:Ec2MachineConfigurator.java

示例3: createVolume

import com.amazonaws.services.ec2.model.CreateVolumeRequest; //导入依赖的package包/类
/**
 * Create Volume.
 *
 * @param availabilityZone the availability zone
 * @param iops the iops
 * @param size the size
 * @param snapshotId the snapshot id
 * @param volumeType the volume type
 * @return Volume
 */
protected final Volume createVolume(final String availabilityZone, final Integer iops, final Integer size, final String snapshotId, final String volumeType) {
    Volume volume = null;

    CreateVolumeRequest req = new CreateVolumeRequest();
    req.setAvailabilityZone(availabilityZone);
    req.setIops(iops);
    req.setSize(size);
    req.setSnapshotId(snapshotId);
    req.setVolumeType(volumeType);
    
    CreateVolumeResult result = amazonEC2Client.createVolume(req);
    if (result != null) {
        volume = result.getVolume();
    }

    return volume;
}
 
开发者ID:treelogic-swe,项目名称:aws-mock,代码行数:28,代码来源:BaseTest.java

示例4: createVolume

import com.amazonaws.services.ec2.model.CreateVolumeRequest; //导入依赖的package包/类
protected Volume createVolume(Zone zone, Integer sizeGb, String snapshotId)
{
    CreateVolumeResult request = ec2_.createVolume(new CreateVolumeRequest()
            .withAvailabilityZone(zone.getName())
            .withSize(sizeGb)
            .withSnapshotId(snapshotId));
    
    return request.getVolume();
}
 
开发者ID:alessandroleite,项目名称:dohko,代码行数:10,代码来源:EC2.java

示例5: createVolume

import com.amazonaws.services.ec2.model.CreateVolumeRequest; //导入依赖的package包/类
public void createVolume(AwsProcessClient awsProcessClient, Long instanceNo, Long volumeNo) {
    AwsVolume awsVolume = awsVolumeDao.read(volumeNo);
    AwsInstance awsInstance = awsInstanceDao.read(instanceNo);

    // ボリュームの作成
    CreateVolumeRequest request = new CreateVolumeRequest();
    request.withSize(awsVolume.getSize());
    request.withSnapshotId(awsVolume.getSnapshotId());
    request.withAvailabilityZone(awsInstance.getAvailabilityZone());

    String volumeType = Config.getProperty("aws.volumeType");
    if (StringUtils.isNotEmpty(volumeType)) {
        request.withVolumeType(volumeType);
    }

    CreateVolumeResult result = awsProcessClient.getEc2Client().createVolume(request);
    Volume volume = result.getVolume();

    String volumeId = volume.getVolumeId();

    // ログ出力
    if (log.isInfoEnabled()) {
        log.info(MessageUtils.getMessage("IPROCESS-100121", volumeId));
    }

    //イベントログ出力
    Component component = null;
    if (awsVolume.getComponentNo() != null) {
        component = componentDao.read(awsVolume.getComponentNo());
    }
    Instance instance = instanceDao.read(instanceNo);
    processLogger.debug(component, instance, "AwsEbsCreate", new Object[] { awsProcessClient.getPlatform()
            .getPlatformName() });

    // データベース更新
    awsVolume.setVolumeId(volume.getVolumeId());
    awsVolume.setStatus(volume.getState());
    awsVolumeDao.update(awsVolume);
}
 
开发者ID:primecloud-controller-org,项目名称:primecloud-controller,代码行数:40,代码来源:AwsVolumeProcess.java

示例6: createVolume

import com.amazonaws.services.ec2.model.CreateVolumeRequest; //导入依赖的package包/类
@Override
public Image createVolume(CreateVolumeRequest request,
        ResultCapture<CreateVolumeResult> extractor) {

    ActionResult result = service.performAction("CreateVolume", request,
            extractor);

    if (result == null) return null;
    return new ImageImpl(result.getResource());
}
 
开发者ID:awslabs,项目名称:aws-sdk-java-resources,代码行数:11,代码来源:EC2Impl.java

示例7: prepareCreateVolumeRequest

import com.amazonaws.services.ec2.model.CreateVolumeRequest; //导入依赖的package包/类
private CreateVolumeRequest prepareCreateVolumeRequest(AuthenticatedContext ac, AwsInstanceView awsInstanceView, AmazonEC2Client client) {
    String availabilityZone = prepareDescribeAvailabilityZonesResult(ac, client);

    CreateVolumeRequest createVolumeRequest = new CreateVolumeRequest().withSize(VOLUME_SIZE).withAvailabilityZone(availabilityZone).withEncrypted(true);
    if (awsInstanceView.isKmsEnabled()) {
        createVolumeRequest.withKmsKeyId(awsInstanceView.getKmsKey());
    }
    return createVolumeRequest;
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:10,代码来源:EncryptedSnapshotPreparator.java

示例8: createVolume

import com.amazonaws.services.ec2.model.CreateVolumeRequest; //导入依赖的package包/类
@Override
public CreateVolumeResult createVolume(CreateVolumeRequest createVolumeRequest) throws AmazonServiceException, AmazonClientException {
    throw new UnsupportedOperationException("Not supported in mock");
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:AmazonEC2Mock.java

示例9: createVolume

import com.amazonaws.services.ec2.model.CreateVolumeRequest; //导入依赖的package包/类
/**
 * Creates an ebs volume.
 */
public void createVolume(CreateVolumeRequest req,
        AsyncHandler<CreateVolumeRequest, CreateVolumeResult> creationHandler) {
    this.client.createVolumeAsync(req, creationHandler);
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:8,代码来源:AwsDiskClient.java

示例10: createVolume

import com.amazonaws.services.ec2.model.CreateVolumeRequest; //导入依赖的package包/类
/**
 * Performs the <code>CreateVolume</code> action.
 *
 * <p>
 *
 * @return The <code>Image</code> resource object associated with the result
 *         of this action.
 * @see CreateVolumeRequest
 */
com.amazonaws.resources.ec2.Image createVolume(CreateVolumeRequest request);
 
开发者ID:awslabs,项目名称:aws-sdk-java-resources,代码行数:11,代码来源:EC2.java


注:本文中的com.amazonaws.services.ec2.model.CreateVolumeRequest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。