use of com.google.cloud.tools.appengine.cloudsdk.process.ProcessOutputLineListener in project google-cloud-intellij by GoogleCloudPlatform.
the class AppEngineStop method stop.
/**
* Stops the given module / version of an App Engine application.
*/
public void stop(@NotNull String module, @NotNull String version, @NotNull ProcessStartListener startListener) {
ProcessOutputLineListener outputListener = new ProcessOutputLineListener() {
@Override
public void onOutputLine(String line) {
loggingHandler.print(line + "\n");
}
};
ProcessExitListener stopExitListener = new StopExitListener();
CloudSdk sdk = helper.createSdk(loggingHandler, startListener, outputListener, outputListener, stopExitListener);
DefaultVersionsSelectionConfiguration configuration = new DefaultVersionsSelectionConfiguration();
configuration.setVersions(Collections.singletonList(version));
configuration.setService(module);
configuration.setProject(deploymentConfiguration.getCloudProjectName());
CloudSdkAppEngineVersions command = new CloudSdkAppEngineVersions(sdk);
command.stop(configuration);
}
use of com.google.cloud.tools.appengine.cloudsdk.process.ProcessOutputLineListener in project app-maven-plugin by GoogleCloudPlatform.
the class CloudSdkAppEngineFactory method defaultCloudSdkBuilder.
protected CloudSdk.Builder defaultCloudSdkBuilder() {
mojo.handleCloudSdkPathDeprecation();
Path sdkPath = mojo.getCloudSdkHome();
if (mojo.getCloudSdkHome() == null) {
sdkPath = cloudSdkOperationsFactory.newDownloader(mojo.getCloudSdkVersion()).downloadCloudSdk(mojo.getLog());
}
CloudSdk.Builder cloudSdkBuilder = cloudSdkFactory.cloudSdkBuilder().sdkPath(sdkPath);
if (mojo.getCloudSdkHome() != null && mojo.getCloudSdkVersion() != null) {
try {
cloudSdkOperationsFactory.newChecker(mojo.getCloudSdkVersion()).checkCloudSdk(cloudSdkBuilder.build());
} catch (CloudSdkNotFoundException | CloudSdkVersionFileException | InvalidJavaSdkException | AppEngineJavaComponentsNotInstalledException | CloudSdkOutOfDateException ex) {
throw new RuntimeException(ex);
}
}
ProcessOutputLineListener lineListener = new DefaultProcessOutputLineListener(mojo.getLog());
return cloudSdkBuilder.addStdOutLineListener(lineListener).addStdErrLineListener(lineListener).exitListener(new NonZeroExceptionExitListener()).appCommandMetricsEnvironment(mojo.getArtifactId()).appCommandMetricsEnvironmentVersion(mojo.getArtifactVersion()).appCommandCredentialFile(mojo.getServiceAccountKeyFile());
}
use of com.google.cloud.tools.appengine.cloudsdk.process.ProcessOutputLineListener in project google-cloud-intellij by GoogleCloudPlatform.
the class AppEngineStandardStage method stage.
/**
* Stage the application in preparation for deployment to the App Engine standard environment.
*
* @param stagingDirectory the local staging directory
* @param onStageComplete a callback for executing actions on completion of staging
*/
public void stage(@NotNull Path stagingDirectory, @NotNull ProcessStartListener startListener, @NotNull ProcessExitListener onStageComplete) {
ProcessOutputLineListener outputListener = new ProcessOutputLineListener() {
@Override
public void onOutputLine(String line) {
loggingHandler.print(line + "\n");
}
};
CloudSdk sdk = helper.createSdk(loggingHandler, startListener, outputListener, outputListener, onStageComplete);
// TODO determine the default set of flags we want to set for AE standard staging
DefaultStageStandardConfiguration stageConfig = new DefaultStageStandardConfiguration();
stageConfig.setEnableJarSplitting(true);
// TODO(joaomartins): Change File to Path on library configs.
stageConfig.setStagingDirectory(stagingDirectory.toFile());
stageConfig.setSourceDirectory(deploymentArtifactPath.toFile());
CloudSdkAppEngineStandardStaging staging = new CloudSdkAppEngineStandardStaging(sdk);
staging.stageStandard(stageConfig);
}
Aggregations