io.cattle.platform.core.model.Instance.getData()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(115)

本文整理了Java中io.cattle.platform.core.model.Instance.getData()方法的一些代码示例,展示了Instance.getData()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Instance.getData()方法的具体详情如下:
包路径:io.cattle.platform.core.model.Instance
类名称:Instance
方法名:getData

Instance.getData介绍

[英]Getter for cattle.instance.data.
[中]cattle.instance.data的Getter。

代码示例

代码示例来源:origin: rancher/cattle

protected Map<String, Object> lookupCacheInstanceData(long instanceId) {
  Instance instance = objectManager.loadResource(Instance.class, instanceId);
  if (instance == null) {
    return Collections.emptyMap();
  }
  Map<String, Object> newData = new HashMap<>();
  newData.put(DataUtils.FIELDS, instance.getData().get(DataUtils.FIELDS));
  return newData;
}

代码示例来源:origin: rancher/cattle

protected List<Long> populateNetworks(Instance instance) {
  return DataUtils.getFieldList(instance.getData(), InstanceConstants.FIELD_NETWORK_IDS, Long.class);
}

代码示例来源:origin: rancher/cattle

protected Set<Long> createCreds(Instance instance, Map<String, Object> data) {
  List<Long> credIds = DataUtils.getFieldList(instance.getData(), InstanceConstants.FIELD_CREDENTIAL_IDS, Long.class);
  return createCredsFromIds(credIds, instance, data);
}

代码示例来源:origin: rancher/cattle

@SuppressWarnings({ "unchecked" })
protected void nativeDockerBackPopulate(Instance instance) {
  Map<String, Object> inspect = (Map<String, Object>)instance.getData().get(FIELD_DOCKER_INSPECT);
  if (inspect == null || instance.getNativeContainer() == null || !instance.getNativeContainer().booleanValue()) {
    return;
  }
  transformer.transform(inspect, instance);
  objectManager.persist(instance);
}

代码示例来源:origin: rancher/cattle

@SuppressWarnings("unchecked")
void processLabels(Instance instance) {
  Map<String, String> labels = CollectionUtils.toMap(CollectionUtils.getNestedValue(instance.getData(), FIELD_DOCKER_INSPECT, "Config",
      "Labels"));
  for (Map.Entry<String, String>label : labels.entrySet()) {
    labelsService.createContainerLabel(instance.getAccountId(), instance.getId(), label.getKey(), label.getValue());
  }
  Map<String, Object> inspect = (Map<String, Object>)instance.getData().get(FIELD_DOCKER_INSPECT);
  if (inspect == null) {
    return;
  }
  transformer.setLabels(instance, inspect);
  objectManager.persist(instance);
}

代码示例来源:origin: rancher/cattle

@Override
public HandlerResult handle(ProcessState state, ProcessInstance process) {
  Instance instance = (Instance)state.getResource();
  List<String> portDefs = DataUtils.getFieldList(instance.getData(), InstanceConstants.FIELD_PORTS, String.class);
  if (portDefs == null) {
    return null;
  }
  List<Port> toCreate = new ArrayList<>();
  Map<String, Port> toRetain = new HashMap<>();
  ntwkDao.updateInstancePorts(instance, portDefs, toCreate, new ArrayList<Port>(), toRetain);
  for (Port port : toCreate) {
    port = objectManager.create(port);
  }
  for (Port port : toRetain.values()) {
    getObjectProcessManager().executeStandardProcess(StandardProcess.CREATE, port, state.getData());
  }
  return null;
}

代码示例来源:origin: rancher/cattle

@SuppressWarnings({ "unchecked" })
protected void processVolumes(Instance instance, Host host, ProcessState state) {
  Map<String, Object> inspect = (Map<String, Object>) instance.getData().get(FIELD_DOCKER_INSPECT);
  List<Object> mounts = (List<Object>) instance.getData().get(FIELD_DOCKER_MOUNTS);
  if (inspect == null && mounts == null) {
    return;

代码示例来源:origin: rancher/cattle

setRemoved(from.getRemoved());
setRemoveTime(from.getRemoveTime());
setData(from.getData());
setAllocationState(from.getAllocationState());
setCompute(from.getCompute());

相关文章