本文整理了Java中io.cattle.platform.core.model.Instance.getExternalId()
方法的一些代码示例,展示了Instance.getExternalId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Instance.getExternalId()
方法的具体详情如下:
包路径:io.cattle.platform.core.model.Instance
类名称:Instance
方法名:getExternalId
[英]Getter for cattle.instance.external_id
.
[中]cattle.instance.external_id
的Getter。
代码示例来源:origin: rancher/cattle
/**
* The docker API allows for identification of a container by name or id.
* This method will return the docker container id (which is stored in the
* externalId field of the instance) if it is available. If it isn't
* available, the instance uuid will be returned, since that is currently
* used as the name for docker containers that do not have the docker id
* set.
*
* @param instance
* @return A string suitable for identifying a container in the docker API.
*/
public static String getDockerIdentifier(Instance instance) {
return !StringUtils.isEmpty(instance.getExternalId()) ? instance.getExternalId() : instance.getUuid();
}
}
代码示例来源:origin: rancher/cattle
private String checkContainerNetwork(String inspectNetMode, Instance instance, Map<String, Object> data) {
if (!StringUtils.startsWith(inspectNetMode, NetworkConstants.NETWORK_MODE_CONTAINER))
return null;
String[] parts = StringUtils.split(inspectNetMode, ":", 2);
String targetContainer = null;
if (parts.length == 2) {
targetContainer = parts[1];
Instance netFromInstance = instanceDao.getInstanceByUuidOrExternalId(instance.getAccountId(), targetContainer, targetContainer);
if (netFromInstance == null) {
Event inspectEvent = newInspectEvent(targetContainer, targetContainer);
Object inspectObj = callAgentForInspect(data, inspectEvent);
Map<String, Object> inspect = CollectionUtils.toMap(inspectObj);
String uuid = getRancherUuidLabel(inspect, null);
String externalId = inspect.get("Id") != null ? inspect.get("Id").toString() : null;
netFromInstance = instanceDao.getInstanceByUuidOrExternalId(instance.getAccountId(), uuid, externalId);
}
if (netFromInstance != null) {
DataAccessor.fields(instance).withKey(FIELD_NETWORK_CONTAINER_ID).set(netFromInstance.getId());
return NetworkConstants.NETWORK_MODE_CONTAINER;
}
}
log.warn("Problem configuring container networking for container [externalId: {}]. Could not find target container: [{}].", instance.getExternalId(),
targetContainer);
return NetworkConstants.NETWORK_MODE_NONE;
}
代码示例来源:origin: rancher/cattle
this.name = instance.getName();
this.uuid = instance.getUuid();
this.external_id = instance.getExternalId();
this.system = instance.getSystem();
Map<String, String> labels = DataAccessor.fields(instance).withKey(InstanceConstants.FIELD_LABELS)
代码示例来源:origin: rancher/cattle
setUserdata(from.getUserdata());
setRegistryCredentialId(from.getRegistryCredentialId());
setExternalId(from.getExternalId());
setNativeContainer(from.getNativeContainer());
setNetworkContainerId(from.getNetworkContainerId());
内容来源于网络,如有侵权,请联系作者删除!