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


Java AmazonEC2Client.startInstances方法代码示例

本文整理汇总了Java中com.amazonaws.services.ec2.AmazonEC2Client.startInstances方法的典型用法代码示例。如果您正苦于以下问题:Java AmazonEC2Client.startInstances方法的具体用法?Java AmazonEC2Client.startInstances怎么用?Java AmazonEC2Client.startInstances使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.amazonaws.services.ec2.AmazonEC2Client的用法示例。


在下文中一共展示了AmazonEC2Client.startInstances方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startInstances

import com.amazonaws.services.ec2.AmazonEC2Client; //导入方法依赖的package包/类
private void startInstances(AmazonEC2Client ec2Client, Exchange exchange) {
    Collection instanceIds;
    StartInstancesRequest request = new StartInstancesRequest();
    if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(EC2Constants.INSTANCES_IDS))) {
        instanceIds = exchange.getIn().getHeader(EC2Constants.INSTANCES_IDS, Collection.class);
        request.withInstanceIds(instanceIds);
    } else {
        throw new IllegalArgumentException("Instances Ids must be specified");
    }
    StartInstancesResult result;
    try {
        result = ec2Client.startInstances(request);
    } catch (AmazonServiceException ase) {
        LOG.trace("Start Instances command returned the error code {}", ase.getErrorCode());
        throw ase;
    }
    LOG.trace("Starting instances with Ids [{}] ", Arrays.toString(instanceIds.toArray()));
    Message message = getMessageForResponse(exchange);
    message.setBody(result);        
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:EC2Producer.java

示例2: startInstance

import com.amazonaws.services.ec2.AmazonEC2Client; //导入方法依赖的package包/类
public void startInstance(AmazonEC2Client ec2Client, String instanceId) throws Exception {
	StartInstancesRequest startReq = new StartInstancesRequest();
	List<String> instanceIds = new ArrayList<String>();
	instanceIds.add(instanceId);
	startReq.setInstanceIds(instanceIds);
	logger.debug("Starting EC2 instance...." + Arrays.toString(instanceIds.toArray(new String[]{})));
	ec2Client.startInstances(startReq);
}
 
开发者ID:bitsofinfo,项目名称:s3-bucket-loader,代码行数:9,代码来源:Ec2Util.java

示例3: startInstances

import com.amazonaws.services.ec2.AmazonEC2Client; //导入方法依赖的package包/类
private StartInstancesResult startInstances(AmazonEC2Client client, String... instanceIds) {
    StartInstancesRequest startRequest = new StartInstancesRequest().withInstanceIds(instanceIds);
    StartInstancesResult startResult = client.startInstances(startRequest);
    return startResult;
}
 
开发者ID:sequenceiq,项目名称:sequenceiq-samples,代码行数:6,代码来源:SimpleInstanceService.java


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