Java Code Examples for com.google.cloud.tools.appengine.operations.CloudSdk#getVersion()

The following examples show how to use com.google.cloud.tools.appengine.operations.CloudSdk#getVersion() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ManagedCloudSdkStartup.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
/**
 * Return the version of the Google Cloud SDK at the given location, or {@code null} if it cannot
 * be determined.
 */
private static CloudSdkVersion getVersion(Path sdkHome) {
  try {
    CloudSdk sdk = new CloudSdk.Builder().sdkPath(sdkHome).build();
    return sdk.getVersion();
  } catch (CloudSdkVersionFileException | CloudSdkNotFoundException ex) {
    return null;
  }
}
 
Example 2
Source File: CloudSdkChecker.java    From app-maven-plugin with Apache License 2.0 5 votes vote down vote up
/**
 * Validates the cloud SDK installation.
 *
 * @param cloudSdk CloudSdk with a configured sdk home directory
 */
public void checkCloudSdk(CloudSdk cloudSdk, String version)
    throws CloudSdkVersionFileException, CloudSdkNotFoundException, CloudSdkOutOfDateException {
  if (!version.equals(cloudSdk.getVersion().toString())) {
    throw new RuntimeException(
        "Specified Cloud SDK version ("
            + version
            + ") does not match installed version ("
            + cloudSdk.getVersion()
            + ").");
  }

  cloudSdk.validateCloudSdk();
}