Class ManagedCloudSdk
- java.lang.Object
-
- com.google.cloud.tools.managedcloudsdk.ManagedCloudSdk
-
public class ManagedCloudSdk extends Object
A manager for installing, configuring and updating the Cloud SDK.
-
-
Field Summary
Fields Modifier and Type Field Description static String
USER_AGENT_STRING
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Path
getGcloudPath()
Returns a path to gcloud executable (operating system specific).Path
getSdkHome()
boolean
hasComponent(SdkComponent component)
Query gcloud to see if component is installed.boolean
isInstalled()
Simple check to verify Cloud SDK installed by verifying the existence of gcloud.boolean
isUpToDate()
Query gcloud to see if SDK is up to date.SdkComponentInstaller
newComponentInstaller()
SdkInstaller
newInstaller()
SdkInstaller
newInstaller(Map<String,String> environmentVariables)
SdkInstaller
newInstaller(Set<String> overrideComponents, Map<String,String> environmentVariables)
Create a newSdkInstaller
with gcloud components to install (override) and environment variables to use while running the installer script.static ManagedCloudSdk
newManagedSdk()
Convenience method to obtain a new LATESTManagedCloudSdk
instance.static ManagedCloudSdk
newManagedSdk(Version version)
Get a newManagedCloudSdk
instance for @{link Version} specified.SdkUpdater
newUpdater()
For "LATEST" version SDKs, the client tooling must keep the SDK up-to-date manually, check withisUpToDate()
before using, returns a new updater if sdk is "LATEST", it will throw aUnsupportedOperationException
if SDK is a fixed version (fixed versions should never be udpated).
-
-
-
Field Detail
-
USER_AGENT_STRING
public static final String USER_AGENT_STRING
- See Also:
- Constant Field Values
-
-
Method Detail
-
getSdkHome
public Path getSdkHome()
-
getGcloudPath
public Path getGcloudPath()
Returns a path to gcloud executable (operating system specific).
-
isInstalled
public boolean isInstalled() throws ManagedSdkVerificationException, ManagedSdkVersionMismatchException
Simple check to verify Cloud SDK installed by verifying the existence of gcloud.
-
hasComponent
public boolean hasComponent(SdkComponent component) throws ManagedSdkVerificationException
Query gcloud to see if component is installed. Uses gcloud's '--local-state-only' to avoid network accesses.- Throws:
ManagedSdkVerificationException
-
isUpToDate
public boolean isUpToDate() throws ManagedSdkVerificationException
Query gcloud to see if SDK is up to date. Gcloud makes a call to the server to check this.- Throws:
ManagedSdkVerificationException
-
newInstaller
public SdkInstaller newInstaller()
-
newInstaller
public SdkInstaller newInstaller(Map<String,String> environmentVariables)
-
newInstaller
public SdkInstaller newInstaller(@Nullable Set<String> overrideComponents, Map<String,String> environmentVariables)
Create a newSdkInstaller
with gcloud components to install (override) and environment variables to use while running the installer script.- Parameters:
overrideComponents
- gcloud components to install instead of the defaultsenvironmentVariables
- environment variables used during installation script run- Returns:
- a
SdkInstaller
-
newComponentInstaller
public SdkComponentInstaller newComponentInstaller()
-
newUpdater
public SdkUpdater newUpdater()
For "LATEST" version SDKs, the client tooling must keep the SDK up-to-date manually, check withisUpToDate()
before using, returns a new updater if sdk is "LATEST", it will throw aUnsupportedOperationException
if SDK is a fixed version (fixed versions should never be udpated).
-
newManagedSdk
public static ManagedCloudSdk newManagedSdk(Version version) throws UnsupportedOsException
Get a newManagedCloudSdk
instance for @{link Version} specified.- Throws:
UnsupportedOsException
-
newManagedSdk
public static ManagedCloudSdk newManagedSdk() throws UnsupportedOsException
Convenience method to obtain a new LATESTManagedCloudSdk
instance.- Throws:
UnsupportedOsException
-
-