我正在尝试在使用 Google Cloud Deployment Manager 的 Java 客户端库创建配置之前预览配置,如下所示。
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();
对于插入,我没有找到设置预览标志的方法。上的API 文档显示有一个可选的查询参数。我想知道如何从上面显示的 Java 客户端设置它。