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

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

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

Instance.getName介绍

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

代码示例

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

public static boolean isRancherAgent(Instance instance) {
  Map<String, Object> labels = DataAccessor.fieldMap(instance, InstanceConstants.FIELD_LABELS);
  return ("rancher-agent".equals(labels.get("io.rancher.container.system")) &&
      "rancher-agent".equals(instance.getName()));
}

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

@Override
public List<Integer> getServiceInstanceUsedSuffixes(Service service, String launchConfigName) {
  Stack env = objectManager.findOne(Stack.class, STACK.ID, service.getStackId());
  // get all existing instances to check if the name is in use by the instance of the same service
  List<Integer> usedSuffixes = new ArrayList<>();
  List<? extends Instance> serviceInstances = exposeMapDao.listServiceManagedInstances(service, launchConfigName);
  for (Instance instance : serviceInstances) {
    if (ServiceDiscoveryUtil.isServiceGeneratedName(env, service, instance.getName())) {
      // legacy code - to support old data where service suffix wasn't set
      usedSuffixes.add(Integer.valueOf(ServiceDiscoveryUtil.getServiceSuffixFromInstanceName(instance
          .getName())));
    }
  }
  return usedSuffixes;
}

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

@Override
public boolean matches(AllocationCandidate candidate) {
  if (candidate.getHost() == null) {
    return false;
  }
  if (op == AffinityOps.SOFT_EQ || op == AffinityOps.EQ) {
    List<? extends Instance> instances = instanceDao.getNonRemovedInstanceOn(candidate.getHost());
    for (Instance instance : instances) {
      if (containerIdentifier != null
          && (containerIdentifier.equalsIgnoreCase(instance.getName()) || containerIdentifier.equalsIgnoreCase(instance.getUuid()))) {
        return true;
      }
    }
    return false;
  } else {
    List<? extends Instance> instances = instanceDao.getNonRemovedInstanceOn(candidate.getHost());
    for (Instance instance : instances) {
      if (containerIdentifier != null && (containerIdentifier.equals(instance.getName()) || containerIdentifier.equals(instance.getUuid()))) {
        return false;
      }
    }
    return true;
  }
}

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

service, serviceContainer.getName(), serviceContainer, launchConfigName);

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

Object objectDisks = DataAccessor.field(instance, InstanceConstants.FIELD_DISKS, Object.class);
if (objectDisks instanceof List<?>) {
  String namePrefix = instance.getName();
  Long svcIndexId = instance.getServiceIndexId();

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

@SuppressWarnings("unchecked")
public void setInstanceAndHostMetadata(Instance instance, HostMetaData host, List<String> healthcheckHosts,
    Account account, InstanceHealthCheck healthCheck) {
  this.name = instance.getName();
  this.uuid = instance.getUuid();
  this.external_id = instance.getExternalId();

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

public void from(io.cattle.platform.core.model.Instance from) {
  setId(from.getId());
  setName(from.getName());
  setAccountId(from.getAccountId());
  setKind(from.getKind());

相关文章