Examples of EC2StopInstances


Examples of com.cloud.bridge.service.core.ec2.EC2StopInstances

        serializeResponse(response, EC2response);
    }

    private void stopInstances( HttpServletRequest request, HttpServletResponse response )
            throws ADBException, XMLStreamException, IOException {
        EC2StopInstances EC2request = new EC2StopInstances();
        int count = 0;

        // -> load in all the "InstanceId.n" parameters if any
        Enumeration<?> names = request.getParameterNames();
        while( names.hasMoreElements()) {
            String key = (String)names.nextElement();
            if (key.startsWith("InstanceId")) {
                String[] value = request.getParameterValues( key );
                if (null != value && 0 < value.length) {
                    EC2request.addInstanceId( value[0] );
                    count++;
                }
            }
        } 
        if (0 == count) {
            throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - InstanceId");
        }

        String[] force = request.getParameterValues("Force");
        if ( force != null) {
            EC2request.setForce( Boolean.parseBoolean(force[0]));
        }

        // -> execute the request
        StopInstancesResponse EC2response = EC2SoapServiceImpl.toStopInstancesResponse( ServiceProvider.getInstance().getEC2Engine().stopInstances( EC2request ));
        serializeResponse(response, EC2response);
View Full Code Here

Examples of com.cloud.bridge.service.core.ec2.EC2StopInstances

        serializeResponse(response, EC2response);
    }

    private void terminateInstances( HttpServletRequest request, HttpServletResponse response )
            throws ADBException, XMLStreamException, IOException {
        EC2StopInstances EC2request = new EC2StopInstances();
        int count = 0;

        // -> load in all the "InstanceId.n" parameters if any
        Enumeration<?> names = request.getParameterNames();
        while( names.hasMoreElements()) {
            String key = (String)names.nextElement();
            if (key.startsWith("InstanceId")) {
                String[] value = request.getParameterValues( key );
                if (null != value && 0 < value.length) {
                    EC2request.addInstanceId( value[0] );
                    count++;
                }
            }
        }   
        if (0 == count) {
            throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - InstanceId");
        }

        // -> execute the request
        EC2request.setDestroyInstances( true );
        TerminateInstancesResponse EC2response = EC2SoapServiceImpl.toTermInstancesResponse( ServiceProvider.getInstance().getEC2Engine().stopInstances( EC2request ));
        serializeResponse(response, EC2response);
    }
View Full Code Here

Examples of com.cloud.bridge.service.core.ec2.EC2StopInstances

    }
    return toStartInstancesResponse( engine.startInstances( request ));
  }
 
  public StopInstancesResponse stopInstances(StopInstances stopInstances) {
    EC2StopInstances request = new EC2StopInstances();
    StopInstancesType sit = stopInstances.getStopInstances();
        Boolean force = sit.getForce();
   
    // -> toEC2StopInstances
    InstanceIdSetType iist  = sit.getInstancesSet();
    InstanceIdType[]  items = iist.getItem();
    if (null != items) {  // -> should not be empty
      for( int i=0; i < items.length; i++ ) request.addInstanceId( items[i].getInstanceId());
    }

        if (force) request.setForce(sit.getForce());
    return toStopInstancesResponse( engine.stopInstances( request ));
  }
View Full Code Here

Examples of com.cloud.bridge.service.core.ec2.EC2StopInstances

   * Mapping this to the destroyVirtualMachine cloud API concept.
   * This makes sense since when considering the rebootInstances function.   In reboot
   * any terminated instances are left alone.   We will do the same with destroyed instances.
   */
  public TerminateInstancesResponse terminateInstances(TerminateInstances terminateInstances) {
    EC2StopInstances request = new EC2StopInstances();
    TerminateInstancesType sit = terminateInstances.getTerminateInstances();
   
    // -> toEC2StopInstances
    InstanceIdSetType iist  = sit.getInstancesSet();
    InstanceIdType[]  items = iist.getItem();
    if (null != items) {  // -> should not be empty
      for( int i=0; i < items.length; i++ ) request.addInstanceId( items[i].getInstanceId());
    }

    request.setDestroyInstances( true );
    return toTermInstancesResponse( engine.stopInstances( request ));
  }
View Full Code Here

Examples of com.cloud.bridge.service.core.ec2.EC2StopInstances

        StartInstancesResponse EC2response = EC2SoapServiceImpl.toStartInstancesResponse(ServiceProvider.getInstance().getEC2Engine().startInstances(EC2request));
        serializeResponse(response, EC2response);
    }

    private void stopInstances(HttpServletRequest request, HttpServletResponse response) throws ADBException, XMLStreamException, IOException {
        EC2StopInstances EC2request = new EC2StopInstances();
        int count = 0;

        // -> load in all the "InstanceId.n" parameters if any
        Enumeration<?> names = request.getParameterNames();
        while (names.hasMoreElements()) {
            String key = (String)names.nextElement();
            if (key.startsWith("InstanceId")) {
                String[] value = request.getParameterValues(key);
                if (null != value && 0 < value.length) {
                    EC2request.addInstanceId(value[0]);
                    count++;
                }
            }
        }
        if (0 == count) {
            throw new EC2ServiceException(ClientError.MissingParamter, "Missing required parameter - InstanceId");
        }

        String[] force = request.getParameterValues("Force");
        if (force != null) {
            EC2request.setForce(Boolean.parseBoolean(force[0]));
        }

        // -> execute the request
        StopInstancesResponse EC2response = EC2SoapServiceImpl.toStopInstancesResponse(ServiceProvider.getInstance().getEC2Engine().stopInstances(EC2request));
        serializeResponse(response, EC2response);
View Full Code Here

Examples of com.cloud.bridge.service.core.ec2.EC2StopInstances

        StopInstancesResponse EC2response = EC2SoapServiceImpl.toStopInstancesResponse(ServiceProvider.getInstance().getEC2Engine().stopInstances(EC2request));
        serializeResponse(response, EC2response);
    }

    private void terminateInstances(HttpServletRequest request, HttpServletResponse response) throws ADBException, XMLStreamException, IOException {
        EC2StopInstances EC2request = new EC2StopInstances();
        int count = 0;

        // -> load in all the "InstanceId.n" parameters if any
        Enumeration<?> names = request.getParameterNames();
        while (names.hasMoreElements()) {
            String key = (String)names.nextElement();
            if (key.startsWith("InstanceId")) {
                String[] value = request.getParameterValues(key);
                if (null != value && 0 < value.length) {
                    EC2request.addInstanceId(value[0]);
                    count++;
                }
            }
        }
        if (0 == count) {
            throw new EC2ServiceException(ClientError.MissingParamter, "Missing required parameter - InstanceId");
        }

        // -> execute the request
        EC2request.setDestroyInstances(true);
        TerminateInstancesResponse EC2response = EC2SoapServiceImpl.toTermInstancesResponse(ServiceProvider.getInstance().getEC2Engine().stopInstances(EC2request));
        serializeResponse(response, EC2response);
    }
View Full Code Here

Examples of com.cloud.bridge.service.core.ec2.EC2StopInstances

    }
    return toStartInstancesResponse( engine.startInstances( request ));
  }
 
  public StopInstancesResponse stopInstances(StopInstances stopInstances) {
    EC2StopInstances request = new EC2StopInstances();
    StopInstancesType sit = stopInstances.getStopInstances();
   
    // -> toEC2StopInstances
    InstanceIdSetType iist  = sit.getInstancesSet();
    InstanceIdType[]  items = iist.getItem();
    if (null != items) {  // -> should not be empty
      for( int i=0; i < items.length; i++ ) request.addInstanceId( items[i].getInstanceId());
    }
    return toStopInstancesResponse( engine.stopInstances( request ));
  }
View Full Code Here

Examples of com.cloud.bridge.service.core.ec2.EC2StopInstances

   * Mapping this to the destroyVirtualMachine cloud API concept.
   * This makes sense since when considering the rebootInstances function.   In reboot
   * any terminated instances are left alone.   We will do the same with destroyed instances.
   */
  public TerminateInstancesResponse terminateInstances(TerminateInstances terminateInstances) {
    EC2StopInstances request = new EC2StopInstances();
    TerminateInstancesType sit = terminateInstances.getTerminateInstances();
   
    // -> toEC2StopInstances
    InstanceIdSetType iist  = sit.getInstancesSet();
    InstanceIdType[]  items = iist.getItem();
    if (null != items) {  // -> should not be empty
      for( int i=0; i < items.length; i++ ) request.addInstanceId( items[i].getInstanceId());
    }

    request.setDestroyInstances( true );
    return toTermInstancesResponse( engine.stopInstances( request ));
  }
View Full Code Here

Examples of com.cloud.bridge.service.core.ec2.EC2StopInstances

        serializeResponse(response, EC2response);
    }

    private void stopInstances( HttpServletRequest request, HttpServletResponse response )
        throws ADBException, XMLStreamException, IOException {
      EC2StopInstances EC2request = new EC2StopInstances();
      int count = 0;
 
      // -> load in all the "InstanceId.n" parameters if any
    Enumeration<?> names = request.getParameterNames();
      while( names.hasMoreElements()) {
        String key = (String)names.nextElement();
        if (key.startsWith("InstanceId")) {
            String[] value = request.getParameterValues( key );
            if (null != value && 0 < value.length) {
              EC2request.addInstanceId( value[0] );
              count++;
            }
        }
      } 
        if (0 == count) { response.sendError(530, "Missing InstanceId parameter" ); return; }
View Full Code Here

Examples of com.cloud.bridge.service.core.ec2.EC2StopInstances

      serializeResponse(response, EC2response);
    }

    private void terminateInstances( HttpServletRequest request, HttpServletResponse response )
        throws ADBException, XMLStreamException, IOException {
        EC2StopInstances EC2request = new EC2StopInstances();
        int count = 0;

        // -> load in all the "InstanceId.n" parameters if any
    Enumeration<?> names = request.getParameterNames();
        while( names.hasMoreElements()) {
          String key = (String)names.nextElement();
          if (key.startsWith("InstanceId")) {
              String[] value = request.getParameterValues( key );
              if (null != value && 0 < value.length) {
                EC2request.addInstanceId( value[0] );
                count++;
              }
          }
        }   
        if (0 == count) { response.sendError(530, "Missing InstanceId parameter" ); return; }

        // -> execute the request
    EC2request.setDestroyInstances( true );
        TerminateInstancesResponse EC2response = EC2SoapServiceImpl.toTermInstancesResponse( ServiceProvider.getInstance().getEC2Engine().stopInstances( EC2request ));
        serializeResponse(response, EC2response);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.