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

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

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

Instance.getAgentId介绍

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

代码示例

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

private List<Long> getAgentResource(Long accountId, List<Instance> instances) {
  List<Long> agentIds = agentInstanceDao.getAgentProvider(SystemLabels.LABEL_AGENT_SERVICE_SCHEDULING_PROVIDER, accountId);
  for (Instance instance : instances) {
    if (agentIds.contains(instance.getAgentId())) {
      return new ArrayList<>();
    }
  }
  return agentIds;
}

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

@Override
public void deleteAgent(Instance instance) {
  if (!shouldCreateAgent(instance) || instance.getAgentId() == null) {
    return;
  }
  Agent agent = objectManager.loadResource(Agent.class, instance.getAgentId());
  if (agent == null) {
    return;
  }
  if (CommonStatesConstants.DEACTIVATING.equals(agent.getState())) {
    return;
  }
  try {
    processManager.scheduleStandardProcess(StandardProcess.DEACTIVATE, agent,
        ProcessUtils.chainInData(new HashMap<String, Object>(), AgentConstants.PROCESS_DEACTIVATE, AgentConstants.PROCESS_REMOVE));
  } catch (ProcessCancelException e) {
    try {
      processManager.scheduleStandardProcess(StandardProcess.REMOVE, agent, null);
    } catch (ProcessCancelException e1) {
    }
  }
}

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

@Override
protected Object getAgentResource(ProcessState state, ProcessInstance process, Object dataResource) {
  Instance instance = getInstance(state);
  if (!isPod(instance)) {
    return false;
  }
  Long accountId = instance.getAccountId();
  List<Long> agentIds = agentInstanceDao.getAgentProvider(SystemLabels.LABEL_AGENT_SERVICE_LABELS_PROVIDER, accountId);
  Long agentId = agentIds.size() == 0 ? null : agentIds.get(0);
  if ((instance instanceof Instance) && (agentIds.contains(instance.getAgentId()) || instance.getSystem())) {
    return null;
  }
  if (agentId == null) {
    if (k8sRequired(instance)) {
      throw new ExecutionException("Failed to find labels provider", instance);
    } else {
      return null;
    }
  }
  return agentId;
}

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

Agent agent = objectManager.loadResource(Agent.class, instance.getAgentId());
if (agent == null) {
  return;

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

deleteAgentAccount(instance.getAgentId(), state.getData());

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

setZoneId(from.getZoneId());
setInstanceTriggeredStop(from.getInstanceTriggeredStop());
setAgentId(from.getAgentId());
setDomain(from.getDomain());
setFirstRunning(from.getFirstRunning());

相关文章