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

x33g5p2x  于2022-01-16 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(149)

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

Agent.getUuid介绍

[英]Getter for cattle.agent.uuid.
[中]cattle.agent.uuid的Getter。

代码示例

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

@Override
  public ExternalAgent handleResponse(HttpResponse response) throws ClientProtocolException, IOException {
    int statusCode = response.getStatusLine().getStatusCode();
    if (statusCode >= 300) {
      throw new IOException(String.format("Failed to delete external agent externalId=%s, response error code %s", agent.getUuid(),
          response.getStatusLine().getReasonPhrase()));
    }
    return null;
  }
});

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

protected void addInstances(AgentConnectionSimulator simulator, Ping pong, Agent agent) {
  List<Map<String, Object>> resources = pong.getData().getResources();
  for (Map.Entry<String, Object[]> kv : simulator.getInstances().entrySet()) {
    // This matches the data structure returned by the ping logic in the real ping agent.
    Map<String, Object> instanceMap = CollectionUtils.asMap(
        ObjectMetaDataManager.TYPE_FIELD, InstanceConstants.TYPE,
        ObjectMetaDataManager.UUID_FIELD, kv.getKey(),
        ObjectMetaDataManager.STATE_FIELD, kv.getValue()[0],
        "systemContainer", null,
        "dockerId", kv.getValue()[1],
        "image", kv.getValue()[2],
        "labels", new String[0],
        "created", kv.getValue()[3]);
    resources.add(instanceMap);
  }
  String hostUuid = agent.getUuid() + "-" + 0;
  Map<String, Object> hostUuidResource = new HashMap<String, Object>();
  hostUuidResource.put(ObjectMetaDataManager.TYPE_FIELD, "hostUuid");
  hostUuidResource.put(ObjectMetaDataManager.UUID_FIELD, hostUuid);
  resources.add(hostUuidResource);
  pong.setOption(Ping.INSTANCES, true);
}

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

protected boolean deactivateAndRemoveExternalAgent(Agent agent, ExternalCredential cred) {
  Region targetRegion = objectManager.loadResource(Region.class, cred.getRegionId());
  if (targetRegion == null) {
    log.info(String.format("Failed to find target region by name [%s]", cred.getRegionName()));
    return true;
  }
  String regionName = cred.getRegionName();
  String envName = cred.getEnvironmentName();
  try {
    log.info(String.format("Removing agent with externalId [%s] in environment [%s] and region [%s]", agent.getUuid(), regionName,
        envName));
    ExternalAgent externalAgent = RegionUtil.getExternalAgent(targetRegion, cred.getAgentUuid(), jsonMapper);
    if (externalAgent == null) {
      log.info(String.format("Failed to find agent by externalId [%s] in environment [%s] and region [%s]", agent.getUuid(), regionName,
          envName));
      return true;
    }
    RegionUtil.deleteExternalAgent(agent, targetRegion, externalAgent);
    return true;
  } catch (Exception e) {
    log.error(
        String.format("Failed to deactivate agent with externalId [%s] in environment [%s] and region [%s]", agent.getUuid(), regionName, envName),
        e);
    return false;
  }
}

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

String targetAgentUri = RegionUtil.getTargetAgentUri(localRegion.getName(), account.getName(), agent.getUuid(), targetResourceAccount.getUuid());
log.info(String.format("Creating external agent with uri [%s] in environment [%s] in region [%s]",
    targetAgentUri,
data.put(CredentialConstants.SECRET_VALUE, cred.getSecretValue());
data.put(AgentConstants.FIELD_URI, targetAgentUri);
data.put(AgentConstants.FIELD_EXTERNAL_ID, agent.getUuid());
Map<String, String> labels = new HashMap<>();
labels.put(SystemLabels.LABEL_AGENT_SERVICE_METADATA, "true");

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

physicalHostUuid = agent.getUuid() + "-physical-host";
String hostUuid = agent.getUuid() + "-" + i;
if (i == 0 && StringUtils.isNotBlank(externalId)) {
  hostUuid = externalId;
    .withKey("ipAddress")
    .withDefault("192.168.0.21").as(String.class);
String ipUuid = agent.getUuid() + "-" + ipAddress;

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

/**
 * {@inheritDoc}
 */
@Override
public void from(io.cattle.platform.core.model.Agent from) {
  setId(from.getId());
  setName(from.getName());
  setAccountId(from.getAccountId());
  setKind(from.getKind());
  setUuid(from.getUuid());
  setDescription(from.getDescription());
  setState(from.getState());
  setCreated(from.getCreated());
  setRemoved(from.getRemoved());
  setRemoveTime(from.getRemoveTime());
  setData(from.getData());
  setUri(from.getUri());
  setManagedConfig(from.getManagedConfig());
  setZoneId(from.getZoneId());
  setExternalId(from.getExternalId());
}

相关文章