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

项目:swordfish-service    文件:EC2RebootImpl.java   
@Override
public void process(Instance instance) {
    ec2UserClient.amazonEC2Async().rebootInstancesAsync(
            new RebootInstancesRequest().withInstanceIds(instance.getInstanceId()),
            new AsyncHandler<RebootInstancesRequest, RebootInstancesResult>() {
                @Override
                public void onError(Exception exception) {
                    log.warn("something went wrong starting the server {}",
                            exception.getLocalizedMessage());
                }

                @Override
                public void onSuccess(RebootInstancesRequest request,
                                      RebootInstancesResult result) {
                    ec2UserClient.amazonEC2Async().waiters()
                            .instanceRunning()
                            .runAsync(ec2Waiter.describeInstancesRequestWaiterParameters(instance.getInstanceId()), ec2Waiter.describeInstancesRequestWaiterHandler());

                }
            });
}
项目:aws-doc-sdk-examples    文件:RebootInstance.java   
public static void main(String[] args)
{
    final String USAGE =
        "To run this example, supply an instance id\n" +
        "Ex: RebootInstnace <instance_id>\n";

    if (args.length != 1) {
        System.out.println(USAGE);
        System.exit(1);
    }

    String instance_id = args[0];

    final AmazonEC2 ec2 = AmazonEC2ClientBuilder.defaultClient();

    RebootInstancesRequest request = new RebootInstancesRequest()
        .withInstanceIds(instance_id);

    RebootInstancesResult response = ec2.rebootInstances(request);

    System.out.printf(
        "Successfully rebooted instance %s", instance_id);
}
项目:Camel    文件:EC2Producer.java   
private void rebootInstances(AmazonEC2Client ec2Client, Exchange exchange) {
    Collection instanceIds;
    RebootInstancesRequest request = new RebootInstancesRequest();
    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");
    }
    try {
        LOG.trace("Rebooting instances with Ids [{}] ", Arrays.toString(instanceIds.toArray()));
        ec2Client.rebootInstances(request);
    } catch (AmazonServiceException ase) {
        LOG.trace("Reboot Instances command returned the error code {}", ase.getErrorCode());
        throw ase;
    }
}
项目:cerberus-lifecycle-cli    文件:Ec2ServiceTest.java   
@Test
public void testRebootInstancesHappy() {

    String instanceId = "instance id";

    ec2Service.rebootEc2Instance(instanceId);

    verify(ec2Client).rebootInstances(new RebootInstancesRequest()
            .withInstanceIds(instanceId)
    );
}
项目:Tank    文件:AmazonInstance.java   
public void attachVolume(String volumneId, String instanceId, String device) {
    AttachVolumeRequest attachVolumeRequest = new AttachVolumeRequest(volumneId, instanceId, device);
    asynchEc2Client.attachVolume(attachVolumeRequest);
    RebootInstancesRequest rebootInstancesRequest = new RebootInstancesRequest();
    rebootInstancesRequest.withInstanceIds(instanceId);
    asynchEc2Client.rebootInstances(rebootInstancesRequest);
}
项目:Tank    文件:AmazonInstance.java   
@Override
public void reboot(List<VMInformation> instances) {
    List<String> instanceIds = new ArrayList<String>(instances.size());
    for (VMInformation instance : instances) {
        instanceIds.add(instance.getInstanceId());
    }
    asynchEc2Client.rebootInstancesAsync(new RebootInstancesRequest(instanceIds));
    // ec2Interface.rebootInstances(instanceIds);
}
项目:cloud-runner    文件:Instance.java   
public void reboot() {
    com.amazonaws.services.ec2.AmazonEC2 client = AmazonEC2.connect();

    RebootInstancesRequest req = new RebootInstancesRequest();
    List<String> instanceIds = new ArrayList<String>();
    instanceIds.add(id);
    req.setInstanceIds(instanceIds);

    client.rebootInstances(req);
}
项目:aws-connector-extension    文件:AWSConnector.java   
public void restartMachine(IMachine machine) throws InvalidObjectException, ConnectorException {
    try {
        getConnector(machine.getImage(), machine.getComputeCenter(), controllerServices).
                rebootInstances(new RebootInstancesRequest(Lists.newArrayList(machine.getName())));
    } catch (Exception e) {
        throw new ConnectorException("Machine restart failed: " + machine.getName(), e);
    }
}
项目:elasticsearch_my    文件:AmazonEC2Mock.java   
@Override
public void rebootInstances(RebootInstancesRequest rebootInstancesRequest) throws AmazonServiceException, AmazonClientException {
    throw new UnsupportedOperationException("Not supported in mock");
}
项目:Camel    文件:AmazonEC2ClientMock.java   
@Override
public RebootInstancesResult rebootInstances(RebootInstancesRequest rebootInstancesRequest) {
    return new RebootInstancesResult();
}
项目:aws-sdk-java-resources    文件:InstanceImpl.java   
@Override
public void reboot(RebootInstancesRequest request) {
    reboot(request, null);
}
项目:aws-sdk-java-resources    文件:InstanceImpl.java   
@Override
public void reboot(RebootInstancesRequest request, ResultCapture<Void>
        extractor) {

    resource.performAction("Reboot", request, extractor);
}
项目:aws-sdk-java-resources    文件:InstanceImpl.java   
@Override
public void reboot(ResultCapture<Void> extractor) {
    RebootInstancesRequest request = new RebootInstancesRequest();
    reboot(request, extractor);
}
项目:cerberus-lifecycle-cli    文件:Ec2Service.java   
/**
 * Reboots the EC2 instance with the given ID
 * @param instanceId - EC2 instance ID
 */
public void rebootEc2Instance(final String instanceId) {

    final RebootInstancesRequest request = new RebootInstancesRequest().withInstanceIds(instanceId);

    ec2Client.rebootInstances(request);
}
项目:aws-sdk-java-resources    文件:Instance.java   
/**
 * Performs the <code>Reboot</code> action.
 *
 * <p>
 * The following request parameters will be populated from the data of this
 * <code>Instance</code> resource, and any conflicting parameter value set
 * in the request will be overridden:
 * <ul>
 *   <li>
 *     <b><code>InstanceIds.0</code></b>
 *         - mapped from the <code>Id</code> identifier.
 *   </li>
 * </ul>
 *
 * <p>
 *
 * @see RebootInstancesRequest
 */
void reboot(RebootInstancesRequest request);
项目:aws-sdk-java-resources    文件:Instance.java   
/**
 * Performs the <code>Reboot</code> action and use a ResultCapture to
 * retrieve the low-level client response.
 *
 * <p>
 * The following request parameters will be populated from the data of this
 * <code>Instance</code> resource, and any conflicting parameter value set
 * in the request will be overridden:
 * <ul>
 *   <li>
 *     <b><code>InstanceIds.0</code></b>
 *         - mapped from the <code>Id</code> identifier.
 *   </li>
 * </ul>
 *
 * <p>
 *
 * @see RebootInstancesRequest
 */
void reboot(RebootInstancesRequest request, ResultCapture<Void> extractor);