• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DeleteSnapshotRequest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: deleteImage

import com.amazonaws.services.ec2.model.DeleteSnapshotRequest; //导入依赖的package包/类
public void deleteImage(Image image) {
    String imageId = image.getImageId();
    logger.info("delete image, imageId={}", imageId);
    ec2.deregisterImage(new DeregisterImageRequest(imageId));

    // our image always uses EBS as first and only drive
    List<BlockDeviceMapping> mappings = image.getBlockDeviceMappings();
    if (!mappings.isEmpty()) {
        EbsBlockDevice ebs = mappings.get(0).getEbs();
        if (ebs != null) {
            String snapshotId = ebs.getSnapshotId();
            logger.info("delete snapshot, snapshotId={}", snapshotId);
            ec2.deleteSnapshot(new DeleteSnapshotRequest(snapshotId));
        }
    }
}
 
开发者ID:neowu,项目名称:cmn-project,代码行数:17,代码来源:EC2.java


示例2: pargeImages

import com.amazonaws.services.ec2.model.DeleteSnapshotRequest; //导入依赖的package包/类
private void pargeImages(AmazonEC2 ec2, Image image) {
	String imageId = image.getImageId();
	ec2.deregisterImage(new DeregisterImageRequest(imageId));
	for (BlockDeviceMapping block : image.getBlockDeviceMappings()) {
		String snapshotId = block.getEbs().getSnapshotId();
		ec2.deleteSnapshot(new DeleteSnapshotRequest().withSnapshotId(snapshotId));
	}
}
 
开发者ID:uzresk,项目名称:aws-auto-operations-using-lambda,代码行数:9,代码来源:ImageStateCheckAndPargeFunction.java


示例3: deleteSnapshot

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


示例4: pargeSnapshot

import com.amazonaws.services.ec2.model.DeleteSnapshotRequest; //导入依赖的package包/类
void pargeSnapshot(AmazonEC2 ec2, String snapshotId) {
	DeleteSnapshotRequest request = new DeleteSnapshotRequest(snapshotId);
	ec2.deleteSnapshot(request);
}
 
开发者ID:uzresk,项目名称:aws-auto-operations-using-lambda,代码行数:5,代码来源:EBSSnapshotFunction.java


示例5: pargeSnapshot

import com.amazonaws.services.ec2.model.DeleteSnapshotRequest; //导入依赖的package包/类
private void pargeSnapshot(AmazonEC2 ec2, String snapshotId, Context context) {

		DeleteSnapshotRequest request = new DeleteSnapshotRequest(snapshotId);
		ec2.deleteSnapshot(request);
		context.getLogger().log("Parge Snapshot. snapshotId[" + snapshotId + "]");
	}
 
开发者ID:uzresk,项目名称:aws-auto-operations-using-lambda,代码行数:7,代码来源:DeregisterImageFunction.java


示例6: deleteSnapshot

import com.amazonaws.services.ec2.model.DeleteSnapshotRequest; //导入依赖的package包/类
/**
 * Delete a Snapshot
 */
public static void deleteSnapshot(AmazonEC2AsyncClient client, String snapshotId) {
    client.deleteSnapshot(new DeleteSnapshotRequest().withSnapshotId(snapshotId));
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:7,代码来源:TestAWSSetupUtils.java


示例7: deleteStorageArtifacts

import com.amazonaws.services.ec2.model.DeleteSnapshotRequest; //导入依赖的package包/类
/**
 * Find the snap & volumes associated with the AMI we used and delete it.
 * AWS doesn't help us out much and the only relationship (as of 2/14/2015)
 * we can leverage is the description field.
 * 
 * @param ami
 *            to find associated snaps for
 * @throws ServiceBrokerExceptions
 */
public void deleteStorageArtifacts(String ami)
		throws ServiceBrokerException {

	DescribeSnapshotsResult desc = ec2Client.describeSnapshots();
	if (null == desc.getSnapshots()) {
		return;
	}
	List<Snapshot> snapshots = desc.getSnapshots();

	// The only way I can find to track the snaps that get created (but not
	// cleaned up) as part of the ami creation is by the description. This
	// code is brittle and will probably fail in unexpected and glamorous
	// ways.
	String amiDesc = "Created by CreateImage(" + sourceInstanceId
			+ ") for " + ami + " from vol";

	// Would be nice if the aws client return optionals...
	List<Snapshot> matching = snapshots.stream()
			.filter(s -> safeContains(s::getDescription, amiDesc))
			.collect(Collectors.toList());

	switch (matching.size()) {
	case 0:
		// Should this throw? Might have been manually cleaned up...but it
		// may orphan the volume. It's done this way to allow people to
		// create their own instances in AWS and not jack them up by
		// deleting the volume
		log.error("No snapshots found for AMI " + ami);
		break;
	case 1:
		String snap = matching.get(0).getSnapshotId();
		log.info("Deleting snapshot " + snap);
		ec2Client.deleteSnapshot(new DeleteSnapshotRequest()
				.withSnapshotId(snap));

		deleteVolumeForSnap(snap);
		break;
	default:
		throw new ServiceBrokerException(
				"Found too many snapshots for AMI " + ami);
	}
}
 
开发者ID:krujos,项目名称:data-lifecycle-service-broker,代码行数:52,代码来源:AWSHelper.java


示例8: delete

import com.amazonaws.services.ec2.model.DeleteSnapshotRequest; //导入依赖的package包/类
@Override
public void delete(DeleteSnapshotRequest request) {
    delete(request, null);
}
 
开发者ID:awslabs,项目名称:aws-sdk-java-resources,代码行数:5,代码来源:SnapshotImpl.java


示例9: snapshotDelete

import com.amazonaws.services.ec2.model.DeleteSnapshotRequest; //导入依赖的package包/类
/** unregister EBS snapshot; will fail if snapshot still in use */
public void snapshotDelete(final String snapshotId) throws Exception {

	final DeleteSnapshotRequest request = new DeleteSnapshotRequest();
	request.setSnapshotId(snapshotId);

	amazonClient.deleteSnapshot(request);

	logger.info("removed snapshotId = " + snapshotId);

}
 
开发者ID:jwrapper,项目名称:jwrapper-maven-plugin,代码行数:12,代码来源:CarrotElasticCompute.java


示例10: delete

import com.amazonaws.services.ec2.model.DeleteSnapshotRequest; //导入依赖的package包/类
/**
 * Performs the <code>Delete</code> action.
 *
 * <p>
 * The following request parameters will be populated from the data of this
 * <code>Snapshot</code> resource, and any conflicting parameter value set
 * in the request will be overridden:
 * <ul>
 *   <li>
 *     <b><code>SnapshotId</code></b>
 *         - mapped from the <code>Id</code> identifier.
 *   </li>
 * </ul>
 *
 * <p>
 *
 * @see DeleteSnapshotRequest
 */
void delete(DeleteSnapshotRequest request);
 
开发者ID:awslabs,项目名称:aws-sdk-java-resources,代码行数:20,代码来源:Snapshot.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java WebScrollPane类代码示例发布时间:2022-05-23
下一篇:
Java EntityModifierList类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap