use of com.google.api.services.compute.model.Operation in project platformlayer by platformlayer.
the class GoogleComputeClient method createFirewallRule.
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) {
throw new OpsException("Timeout while waiting for firewall creation", e);
}
}
use of com.google.api.services.compute.model.Operation in project google-cloud-java by GoogleCloudPlatform.
the class HttpComputeRpc method listGlobalOperations.
@Override
public Tuple<String, Iterable<Operation>> listGlobalOperations(Map<Option, ?> options) {
try {
OperationList operationsList = compute.globalOperations().list(this.options.getProjectId()).setFilter(Option.FILTER.getString(options)).setMaxResults(Option.MAX_RESULTS.getLong(options)).setPageToken(Option.PAGE_TOKEN.getString(options)).setFields(Option.FIELDS.getString(options)).execute();
Iterable<Operation> operations = operationsList.getItems();
return Tuple.of(operationsList.getNextPageToken(), operations);
} catch (IOException ex) {
throw translate(ex);
}
}
use of com.google.api.services.compute.model.Operation in project google-cloud-java by GoogleCloudPlatform.
the class HttpComputeRpc method listRegionOperations.
@Override
public Tuple<String, Iterable<Operation>> listRegionOperations(String region, Map<Option, ?> options) {
try {
OperationList operationsList = compute.regionOperations().list(this.options.getProjectId(), region).setFilter(Option.FILTER.getString(options)).setMaxResults(Option.MAX_RESULTS.getLong(options)).setPageToken(Option.PAGE_TOKEN.getString(options)).setFields(Option.FIELDS.getString(options)).execute();
Iterable<Operation> operations = operationsList.getItems();
return Tuple.of(operationsList.getNextPageToken(), operations);
} catch (IOException ex) {
throw translate(ex);
}
}
use of com.google.api.services.compute.model.Operation in project google-cloud-java by GoogleCloudPlatform.
the class HttpComputeRpc method listZoneOperations.
@Override
public Tuple<String, Iterable<Operation>> listZoneOperations(String zone, Map<Option, ?> options) {
try {
OperationList operationsList = compute.zoneOperations().list(this.options.getProjectId(), zone).setFilter(Option.FILTER.getString(options)).setMaxResults(Option.MAX_RESULTS.getLong(options)).setPageToken(Option.PAGE_TOKEN.getString(options)).setFields(Option.FIELDS.getString(options)).execute();
Iterable<Operation> operations = operationsList.getItems();
return Tuple.of(operationsList.getNextPageToken(), operations);
} catch (IOException ex) {
throw translate(ex);
}
}
Aggregations