Package com.google.api.services.compute.model

Examples of com.google.api.services.compute.model.Operation


  }

  @Override
  public void terminate() throws OpsException {
    try {
      Operation operation = computeClient.terminateInstance(instance.getName());
      computeClient.waitComplete(operation, 5, TimeUnit.MINUTES);
    } catch (TimeoutException e) {
      throw new OpsException("Timeout waiting for instance termination", e);
    }
View Full Code Here


  }

  public void createFirewallRule(Firewall rule) throws OpsException {
    try {
      log.debug("Inserting firewall rule: " + rule);
      Operation operation = compute.firewalls().insert(projectId, rule).execute();
      waitComplete(operation, 5, TimeUnit.MINUTES);
      // TODO: Check success of operation?
    } catch (IOException e) {
      throw new OpsException("Error creating firewall", e);
    } catch (TimeoutException e) {
View Full Code Here

  }

  public void deleteFirewallRule(Firewall rule) throws OpsException {
    try {
      log.debug("Deleting firewall rule: " + rule);
      Operation operation = compute.firewalls().delete(projectId, rule.getName()).execute();
      waitComplete(operation, 5, TimeUnit.MINUTES);
      // TODO: Check success of operation?
    } catch (IOException e) {
      throw new OpsException("Error deleting firewall", e);
    } catch (TimeoutException e) {
View Full Code Here

      // GCE requires that the name comply with RFC1035, which I think means a valid DNS
      // For now, just use a UUID, with a pl- prefix so it doesn't start with a number
      // TODO: Fix this!
      String instanceName = "pl-" + UUID.randomUUID().toString();

      Operation createServerOperation;
      {
        Instance create = new Instance();

        create.setName(instanceName);
View Full Code Here

  public Operation terminateInstance(String instanceId) throws OpsException {
    try {
      log.debug("Terminating instance: " + instanceId);

      Operation operation = compute.instances().delete(projectId, instanceId).execute();
      return operation;
    } catch (IOException e) {
      throw new OpsException("Error deleting instance", e);
    }
  }
View Full Code Here

        // SecurityGroup securityGroup = null;
        // if (supportsSecurityGroups) {
        // securityGroup = openstackHelpers.getMachineSecurityGroup(computeClient, server);
        // }

        Operation terminateOperation = computeClient.terminateInstance(instanceId);
        try {
          computeClient.waitComplete(terminateOperation, 5, TimeUnit.MINUTES);
        } catch (TimeoutException e) {
          throw new OpsException("Timeout while waiting for instance termination", e);
        }
View Full Code Here

    public Boolean delete(Resource resource, GccDeleteContextObject d) throws Exception {
        Stack stack = stackRepository.findById(d.getStackId());
        try {
            GccTemplate gccTemplate = (GccTemplate) stack.getTemplate();
            GccCredential gccCredential = (GccCredential) stack.getCredential();
            Operation execute = d.getCompute().firewalls().delete(gccCredential.getProjectId(), resource.getResourceName()).execute();
            Compute.ZoneOperations.Get zoneOperations = createZoneOperations(d.getCompute(), gccCredential, gccTemplate, execute);
            Compute.GlobalOperations.Get globalOperations = createGlobalOperations(d.getCompute(), gccCredential, gccTemplate, execute);
            GccRemoveReadyPollerObject gccRemoveReady =
                    new GccRemoveReadyPollerObject(zoneOperations, globalOperations, stack, resource.getResourceName());
            gccRemoveReadyPollerObjectPollingService.pollWithTimeout(gccRemoveCheckerStatus, gccRemoveReady, POLLING_INTERVAL, MAX_POLLING_ATTEMPTS);
View Full Code Here

    public Boolean delete(Resource resource, GccDeleteContextObject d) throws Exception {
        Stack stack = stackRepository.findById(d.getStackId());
        try {
            GccTemplate gccTemplate = (GccTemplate) stack.getTemplate();
            GccCredential gccCredential = (GccCredential) stack.getCredential();
            Operation execute = d.getCompute().firewalls().delete(gccCredential.getProjectId(), resource.getResourceName()).execute();
            Compute.ZoneOperations.Get zoneOperations = createZoneOperations(d.getCompute(), gccCredential, gccTemplate, execute);
            Compute.GlobalOperations.Get globalOperations = createGlobalOperations(d.getCompute(), gccCredential, gccTemplate, execute);
            GccRemoveReadyPollerObject gccRemoveReady =
                    new GccRemoveReadyPollerObject(zoneOperations, globalOperations, stack, resource.getResourceName());
            gccRemoveReadyPollerObjectPollingService.pollWithTimeout(gccRemoveCheckerStatus, gccRemoveReady, POLLING_INTERVAL, MAX_POLLING_ATTEMPTS);
View Full Code Here

    public Boolean delete(Resource resource, GccDeleteContextObject d) throws Exception {
        Stack stack = stackRepository.findById(d.getStackId());
        try {
            GccTemplate gccTemplate = (GccTemplate) stack.getTemplate();
            GccCredential gccCredential = (GccCredential) stack.getCredential();
            Operation execute = d.getCompute().networks().delete(gccCredential.getProjectId(), resource.getResourceName()).execute();
            Compute.ZoneOperations.Get zoneOperations = createZoneOperations(d.getCompute(), gccCredential, gccTemplate, execute);
            Compute.GlobalOperations.Get globalOperations = createGlobalOperations(d.getCompute(), gccCredential, gccTemplate, execute);
            GccRemoveReadyPollerObject gccRemoveReady =
                    new GccRemoveReadyPollerObject(zoneOperations, globalOperations, stack, resource.getResourceName());
            gccRemoveReadyPollerObjectPollingService.pollWithTimeout(gccRemoveCheckerStatus, gccRemoveReady, POLLING_INTERVAL, MAX_POLLING_ATTEMPTS);
View Full Code Here

    public Boolean delete(Resource resource, GccDeleteContextObject d) throws Exception {
        Stack stack = stackRepository.findById(d.getStackId());
        try {
            GccTemplate gccTemplate = (GccTemplate) stack.getTemplate();
            GccCredential gccCredential = (GccCredential) stack.getCredential();
            Operation execute = d.getCompute().disks()
                    .delete(gccCredential.getProjectId(), gccTemplate.getGccZone().getValue(), resource.getResourceName()).execute();
            Compute.ZoneOperations.Get zoneOperations = createZoneOperations(d.getCompute(), gccCredential, gccTemplate, execute);
            Compute.GlobalOperations.Get globalOperations = createGlobalOperations(d.getCompute(), gccCredential, gccTemplate, execute);
            GccRemoveReadyPollerObject gccRemoveReady =
                    new GccRemoveReadyPollerObject(zoneOperations, globalOperations, stack, resource.getResourceName());
View Full Code Here

TOP

Related Classes of com.google.api.services.compute.model.Operation

Copyright © 2018 www.massapicom. 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.