當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。