static String getInstanceIp(AccountDeploymentDetails<GoogleAccount> details, String instanceName) { Compute compute = getCompute(details); Instance instance = null; try { instance = compute.instances().get(details.getAccount().getProject(), "us-central1-f", instanceName).execute(); } catch (IOException e) { throw new HalException(FATAL, "Unable to get instance " + instanceName); } return instance.getNetworkInterfaces() .stream() .map(i -> i.getAccessConfigs().stream() .map(AccessConfig::getNatIP) .filter(ip -> !StringUtils.isEmpty(ip)) .findFirst() ).filter(Optional::isPresent) .map(Optional::get) .findFirst() .orElseThrow(() -> new HalException(FATAL, "No public IP associated with" + instanceName)); }
static String getInstanceIp(AccountDeploymentDetails<GoogleAccount> details, String instanceName) { Compute compute = getCompute(details); Instance instance = null; try { instance = compute.instances().get(details.getAccount().getProject(), "us-central1-f", instanceName).execute(); } catch (IOException e) { throw new HalException(FATAL, "Unable to get instance " + instanceName); } return instance.getNetworkInterfaces() .stream() .map(i -> i.getAccessConfigs().stream() .map(AccessConfig::getNatIP) .filter(ip -> !StringUtils.isEmpty(ip)) .findFirst() ).filter(Optional::isPresent) .map(Optional::get) .findFirst() .orElseThrow(() -> new HalException(FATAL, "No public IP associated with" + instanceName)); }
static public void resize(AccountDeploymentDetails<GoogleAccount> details, String zone, String managedInstaceGroupName, int targetSize) { Compute compute = getCompute(details); try { compute.instanceGroupManagers().resize(details.getAccount().getProject(), zone, managedInstaceGroupName, targetSize); } catch (IOException e) { throw new HalException(FATAL, "Unable to resize instance group manager " + managedInstaceGroupName + ": " + e.getMessage(), e); } }
static public void resize(AccountDeploymentDetails<GoogleAccount> details, String zone, String managedInstaceGroupName, int targetSize) { Compute compute = getCompute(details); try { compute.instanceGroupManagers().resize(details.getAccount().getProject(), zone, managedInstaceGroupName, targetSize); } catch (IOException e) { throw new HalException(FATAL, "Unable to resize instance group manager " + managedInstaceGroupName + ": " + e.getMessage(), e); } }
static String defaultServiceAccount(AccountDeploymentDetails<GoogleAccount> details) { GoogleAccount account = details.getAccount(); String project = account.getProject(); Compute compute = getCompute(details); try { return compute.projects().get(project).execute().getDefaultServiceAccount(); } catch (IOException e) { throw new HalException(FATAL, "Unable to get default compute service account"); } }
static String defaultServiceAccount(AccountDeploymentDetails<GoogleAccount> details) { GoogleAccount account = details.getAccount(); String project = account.getProject(); Compute compute = getCompute(details); try { return compute.projects().get(project).execute().getDefaultServiceAccount(); } catch (IOException e) { throw new HalException(FATAL, "Unable to get default compute service account"); } }
RunningServiceDetails result = new RunningServiceDetails(); result.setLoadBalancer(new RunningServiceDetails.LoadBalancer().setExists(true)); // All GCE load balancing is done via consul Compute compute = GoogleProviderUtils.getCompute(details); GoogleAccount account = details.getAccount(); List<InstanceGroupManager> migs;
RunningServiceDetails result = new RunningServiceDetails(); result.setLoadBalancer(new RunningServiceDetails.LoadBalancer().setExists(true)); // All GCE load balancing is done via consul Compute compute = GoogleProviderUtils.getCompute(details); GoogleAccount account = details.getAccount(); List<InstanceGroupManager> migs;
String project = details.getAccount().getProject(); Compute compute = getCompute(details); boolean exists = true; try {
String project = details.getAccount().getProject(); Compute compute = getCompute(details); boolean exists = true; try {
String zone = settings.getLocation(); String project = details.getAccount().getProject(); Compute compute = GoogleProviderUtils.getCompute(details); InstanceGroupManager mig; try {
String zone = settings.getLocation(); String project = details.getAccount().getProject(); Compute compute = GoogleProviderUtils.getCompute(details); InstanceGroupManager mig; try {
Compute compute = GoogleProviderUtils.getCompute(details); String project = account.getProject(); String zone = settings.getLocation();
Compute compute = GoogleProviderUtils.getCompute(details); String project = account.getProject(); String zone = settings.getLocation();