Codota Logo
ServiceIndex
Code IndexAdd Codota to your IDE (free)

How to use
ServiceIndex
in
io.cattle.platform.core.model

Best Java code snippets using io.cattle.platform.core.model.ServiceIndex (Showing top 10 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Dictionary d =
  • Codota Iconnew Hashtable()
  • Codota IconBundle bundle;bundle.getHeaders()
  • Codota Iconnew Properties()
  • Smart code suggestions by Codota
}
origin: rancher/cattle

/**
 * {@inheritDoc}
 */
@Override
public void from(io.cattle.platform.core.model.ServiceIndex 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());
  setServiceIndex(from.getServiceIndex());
  setLaunchConfigName(from.getLaunchConfigName());
  setServiceId(from.getServiceId());
  setAddress(from.getAddress());
}
origin: rancher/cattle

/**
 * {@inheritDoc}
 */
@Override
public <E extends io.cattle.platform.core.model.ServiceIndex> E into(E into) {
  into.from(this);
  return into;
}
origin: rancher/cattle

@SuppressWarnings("unchecked")
protected Map<String, Object> populateLaunchConfigData(Map<String, Object> deployParams) {
  Map<String, Object> launchConfigData = ServiceDiscoveryUtil.buildServiceInstanceLaunchData(service,
      deployParams, launchConfigName, context.allocationHelper);
  launchConfigData.put("name", this.instanceName);
  launchConfigData.remove(ServiceDiscoveryConfigItem.RESTART.getCattleName());
  Object labels = launchConfigData.get(InstanceConstants.FIELD_LABELS);
  if (labels != null) {
    String overrideHostName = ((Map<String, String>) labels)
        .get(ServiceConstants.LABEL_OVERRIDE_HOSTNAME);
    if (StringUtils.equalsIgnoreCase(overrideHostName, "container_name")) {
      String domainName = (String) launchConfigData.get(DockerInstanceConstants.FIELD_DOMAIN_NAME);
      String overrideName = getOverrideHostName(domainName, this.instanceName);
      launchConfigData.put(InstanceConstants.FIELD_HOSTNAME, overrideName);
    }
  }
  launchConfigData.put(InstanceConstants.FIELD_SERVICE_INSTANCE_SERVICE_INDEX_ID,
      this.serviceIndex.getId());
  launchConfigData.put(InstanceConstants.FIELD_SERVICE_INSTANCE_SERVICE_INDEX,
      this.serviceIndex.getServiceIndex());
  launchConfigData.put(InstanceConstants.FIELD_ALLOCATED_IP_ADDRESS, serviceIndex.getAddress());
  return launchConfigData;
}
origin: rancher/cattle

  @Override
  protected void populatedData(Account system, List<Object> toCreate) {
    List<Instance> instances = objectManager
        .find(Instance.class, INSTANCE.REMOVED, new Condition(ConditionType.NULL));
    List<ServiceIndex> serviceIndexes = objectManager
        .find(ServiceIndex.class, SERVICE_INDEX.REMOVED, new Condition(ConditionType.NULL));
    Map<Long, ServiceIndex> serviceIndexIdsToIndexes = new HashMap<>();
    for (ServiceIndex index : serviceIndexes) {
      serviceIndexIdsToIndexes.put(index.getId(), index);
    }
    for (Instance instance : instances) {
      Long indexId = instance.getServiceIndexId();
      if (indexId == null) {
        continue;
      }
      ServiceIndex index = serviceIndexIdsToIndexes.get(indexId);
      if (index == null) {
        continue;
      }
      Map<String, Object> data = new HashMap<>();
      data.put(InstanceConstants.FIELD_SERVICE_INSTANCE_SERVICE_INDEX, index.getServiceIndex());
      objectManager.setFields(instance, data);
    }
  }
}
origin: rancher/cattle

  public void cleanupUnusedAndDuplicatedServiceIndexes() {
    Map<String, List<Long>> launchConfigToServiceIndexes = getUsedServiceIndexesIds(true);

    for (ServiceIndex serviceIndex : context.objectManager.find(ServiceIndex.class, SERVICE_INDEX.SERVICE_ID,
        service.getId(), SERVICE_INDEX.REMOVED, null)) {
      boolean remove = false;
      List<Long> usedServiceIndexes = launchConfigToServiceIndexes.get(serviceIndex.getLaunchConfigName());
      if (usedServiceIndexes == null) {
        remove = true;
      } else {
        if (!usedServiceIndexes.contains(serviceIndex.getId())) {
          remove = true;
        }
      }
      if (remove) {
        context.objectProcessManager.scheduleStandardProcessAsync(StandardProcess.REMOVE, serviceIndex, null);
      }
    }
  }
}
origin: rancher/cattle

@Override
public void releaseIpFromServiceIndex(Service service, ServiceIndex serviceIndex) {
  if (!StringUtils.isEmpty(serviceIndex.getAddress())) {
    String ntwkMode = networkService.getNetworkMode(DataAccessor
        .fieldMap(service, ServiceConstants.FIELD_LAUNCH_CONFIG));
    if (ntwkMode == null) {
      return;
    }
    Network ntwk = networkService.resolveNetwork(serviceIndex.getAccountId(), ntwkMode);
    networkService.releaseIpAddress(ntwk, serviceIndex);
  }
}
origin: rancher/cattle

protected Map<String, List<Long>> getUsedServiceIndexesIds(boolean cleanupDuplicates) {
  // revamp healthy/bad units by excluding units with duplicated indexes
  Map<String, List<Long>> launchConfigToServiceIndexes = new HashMap<>();
  Iterator<DeploymentUnit> it = healthyUnits.iterator();
  while (it.hasNext()) {
    DeploymentUnit healthyUnit = it.next();
    for (DeploymentUnitInstance instance : healthyUnit.getDeploymentUnitInstances()) {
      if (instance.getServiceIndex() == null) {
        continue;
      }
      Long serviceIndexId = instance.getServiceIndex().getId();
      String launchConfigName = instance.getLaunchConfigName();
      List<Long> usedServiceIndexes = launchConfigToServiceIndexes.get(launchConfigName);
      if (usedServiceIndexes == null) {
        usedServiceIndexes = new ArrayList<>();
      }
      if (cleanupDuplicates) {
        if (usedServiceIndexes.contains(serviceIndexId)) {
          badUnits.add(healthyUnit);
          it.remove();
          break;
        }
      }
      usedServiceIndexes.add(serviceIndexId);
      launchConfigToServiceIndexes.put(launchConfigName, usedServiceIndexes);
    }
  }
  return launchConfigToServiceIndexes;
}
origin: rancher/cattle

  @Override
  public HandlerResult handle(ProcessState state, ProcessInstance process) {
    ServiceIndex serviceIndex = (ServiceIndex) state.getResource();

    Service service = objectManager.loadResource(Service.class, serviceIndex.getServiceId());

    if (service == null) {
      return null;
    }

    sdService.releaseIpFromServiceIndex(service, serviceIndex);

    return null;
  }
}
origin: rancher/cattle

@Override
public void allocateIpToServiceIndex(Service service, ServiceIndex serviceIndex, List<String> requestedIps) {
  if (StringUtils.isEmpty(serviceIndex.getAddress())) {
    String ntwkMode = networkService.getNetworkMode(DataAccessor
        .fieldMap(service, ServiceConstants.FIELD_LAUNCH_CONFIG));
    if (ntwkMode == null) {
      return;
    }
    Network ntwk = networkService.resolveNetwork(serviceIndex.getAccountId(), ntwkMode.toString());
    if (networkService.shouldAssignIpAddress(ntwk)) {
      IPAssignment assignment = networkService.assignIpAddress(ntwk, serviceIndex, requestedIps);
      if (assignment != null) {
        setServiceIndexIp(serviceIndex, assignment.getIpAddress());
      }
    }
  }
}
origin: rancher/cattle

  @Override
  protected void populatedData(Account system, List<Object> toCreate) {
    List<Instance> instances = objectManager
        .find(Instance.class, INSTANCE.REMOVED, new Condition(ConditionType.NULL));
    List<ServiceIndex> serviceIndexes = objectManager
        .find(ServiceIndex.class, SERVICE_INDEX.REMOVED, new Condition(ConditionType.NULL));
    List<Long> serviceIndexIds = new ArrayList<>();
    for (ServiceIndex index : serviceIndexes) {
      serviceIndexIds.add(index.getId());
    }
    for (Instance instance : instances) {
      Long toUpdate = DataAccessor.fieldLong(instance, InstanceConstants.FIELD_SERVICE_INSTANCE_SERVICE_INDEX_ID);
      if (toUpdate != null && serviceIndexIds.contains(toUpdate)) {
        Map<String, Object> data = new HashMap<>();
        data.put(InstanceConstants.FIELD_SERVICE_INSTANCE_SERVICE_INDEX_ID, toUpdate);
        objectManager.setFields(instance, data);
      }
    }
  }
}
io.cattle.platform.core.modelServiceIndex

Javadoc

This class is generated by jOOQ.

Most used methods

  • getId
    Getter for cattle.service_index.id.
  • getServiceIndex
    Getter for cattle.service_index.service_index.
  • getAccountId
    Getter for cattle.service_index.account_id.
  • getAddress
    Getter for cattle.service_index.address.
  • getLaunchConfigName
    Getter for cattle.service_index.launch_config_name.
  • getServiceId
    Getter for cattle.service_index.service_id.
  • from
    Load data from another generated Record/POJO implementing the common interface ServiceIndex
  • getCreated
    Getter for cattle.service_index.created.
  • getData
    Getter for cattle.service_index.data.
  • getDescription
    Getter for cattle.service_index.description.
  • getKind
    Getter for cattle.service_index.kind.
  • getName
    Getter for cattle.service_index.name.
  • getKind,
  • getName,
  • getRemoveTime,
  • getRemoved,
  • getState,
  • getUuid

Popular in Java

  • Making http post requests using okhttp
  • onRequestPermissionsResult (Fragment)
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • putExtra (Intent)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • FileInputStream (java.io)
    A FileInputStream obtains input bytes from a file in a file system. What files are available depends
  • InputStreamReader (java.io)
    An InputStreamReader is a bridge from byte streams to character streams: It reads bytes and decodes
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • ConcurrentHashMap (java.util.concurrent)
    A hash table supporting full concurrency of retrievals and adjustable expected concurrency for updat
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now