0

I'm trying to preview a configuration before creating it using the Java client libraries for Google Cloud Deployment Manager like shown below.


DeploymentManager deploymentManagerService = createDeploymentManagerService();
Deployment requestBody = new Deployment();
requestBody.setName(deployment);
TargetConfiguration config = new TargetConfiguration();
ConfigFile configFile = new ConfigFile();

File file = new File("C:\\gcp-work\\two-vms.yaml");
byte[] encoded = Files.readAllBytes(Paths.get(file.getPath()));
String content =  new String(encoded);
configFile.setContent(content);
config.setConfig(configFile);
requestBody.setTarget(config);

Deployments.Insert insReq = deploymentManagerService.deployments().insert(PROJECT_NAME, requestBody);
Operation oprtn =  insReq.execute();

For the insert I'm not finding a way to set the preview flag. The API documentation on shows that there is an optional query parameter. I'm wondering how to set it from a Java client like mine shown above.

Kishore Namala
  • 109
  • 1
  • 9

1 Answers1

1

The DeploymentManager.deployments.instert class java doc may help you with the possible actions.

My educated guess is you need to call this before execute():

insReq.setPreview(true);

Adam Ocsvari
  • 8,056
  • 2
  • 17
  • 30