本文整理汇总了Java中mesosphere.marathon.client.model.v2.App.setLabels方法的典型用法代码示例。如果您正苦于以下问题:Java App.setLabels方法的具体用法?Java App.setLabels怎么用?Java App.setLabels使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mesosphere.marathon.client.model.v2.App
的用法示例。
在下文中一共展示了App.setLabels方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateExternalTaskRepresentation
import mesosphere.marathon.client.model.v2.App; //导入方法依赖的package包/类
@Override
protected App generateExternalTaskRepresentation(MarathonApp marathonTask) {
App app = new App();
String id = marathonTask.getId();
if (!APP_NAME_VALIDATOR.matcher(id).matches()) {
throw new IllegalArgumentException(String.format(
"Illegal name for TOSCA node <%s>: "
+ "name for nodes of type %s must fully match regular expression %s",
id, marathonTask.getToscaNodeName(), APP_NAME_VALIDATOR.pattern()));
}
app.setId(id);
app.setCmd(marathonTask.getCmd());
app.setConstraints(marathonTask.getConstraints());
app.setCpus(marathonTask.getCpus());
app.setMem(marathonTask.getMemSize());
app.setUris(marathonTask.getUris());
app.setLabels(marathonTask.getLabels());
app.setEnv(new HashMap<>(marathonTask.getEnv()));
app.setInstances(marathonTask.getInstances());
marathonTask
.getContainer()
.ifPresent(mesosContainer -> app.setContainer(generateContainer(mesosContainer)));
return app;
}
示例2: createApp
import mesosphere.marathon.client.model.v2.App; //导入方法依赖的package包/类
protected App createApp(int minInstances, int maxInstances)
{
App app = createApp();
HashMap<String, String> labels = new HashMap<>();
labels.put(MarathonMonitor.LABEL_SCALING_STRATEGY, Horizontal.NAME);
labels.put(Horizontal.LABEL_MIN_INSTANCES, Integer.toString(minInstances));
labels.put(Horizontal.LABEL_MAX_INSTANCES, Integer.toString(maxInstances));
app.setLabels(labels);
return app;
}