private String parseGroupFrom(final RunningInstance instance, final Set<String> data) { String group = null; try { Predicate<String> containsAnyGroup = namingConvention.create().containsAnyGroup(); String encodedGroup = Iterables.getOnlyElement(Iterables.filter(data, containsAnyGroup)); group = namingConvention.create().extractGroup(encodedGroup); } catch (NoSuchElementException e) { logger.debug("no group parsed from %s's data: %s", instance.getId(), data); } catch (IllegalArgumentException e) { logger.debug("too many groups match naming convention; %s's data: %s", instance.getId(), data); } return group; }
private String parseGroupFrom(final RunningInstance instance, final Set<String> data) { String group = null; try { Predicate<String> containsAnyGroup = namingConvention.create().containsAnyGroup(); String encodedGroup = Iterables.getOnlyElement(Iterables.filter(data, containsAnyGroup)); group = namingConvention.create().extractGroup(encodedGroup); } catch (NoSuchElementException e) { logger.debug("no group parsed from %s's data: %s", instance.getId(), data); } catch (IllegalArgumentException e) { logger.debug("too many groups match naming convention; %s's data: %s", instance.getId(), data); } return group; }
private String parseGroupFrom(final RunningInstance instance, final Set<String> data) { String group = null; try { Predicate<String> containsAnyGroup = namingConvention.create().containsAnyGroup(); String encodedGroup = Iterables.getOnlyElement(Iterables.filter(data, containsAnyGroup)); group = namingConvention.create().extractGroup(encodedGroup); } catch (NoSuchElementException e) { logger.debug("no group parsed from %s's data: %s", instance.getId(), data); } catch (IllegalArgumentException e) { logger.debug("too many groups match naming convention; %s's data: %s", instance.getId(), data); } return group; }
private String parseGroupFrom(final RunningInstance instance, final Set<String> data) { String group = null; try { Predicate<String> containsAnyGroup = namingConvention.create().containsAnyGroup(); String encodedGroup = Iterables.getOnlyElement(Iterables.filter(data, containsAnyGroup)); group = namingConvention.create().extractGroup(encodedGroup); } catch (NoSuchElementException e) { logger.debug("no group parsed from %s's data: %s", instance.getId(), data); } catch (IllegalArgumentException e) { logger.debug("too many groups match naming convention; %s's data: %s", instance.getId(), data); } return group; }
private String parseGroupFrom(final RunningInstance instance, final Set<String> data) { String group = null; try { Predicate<String> containsAnyGroup = namingConvention.create().containsAnyGroup(); String encodedGroup = Iterables.getOnlyElement(Iterables.filter(data, containsAnyGroup)); group = namingConvention.create().extractGroup(encodedGroup); } catch (NoSuchElementException e) { logger.debug("no group parsed from %s's data: %s", instance.getId(), data); } catch (IllegalArgumentException e) { logger.debug("too many groups match naming convention; %s's data: %s", instance.getId(), data); } return group; }
@Override public NodeMetadata apply(ServerInfo serverInfo) { NodeMetadataBuilder builder = new NodeMetadataBuilder(); builder.ids(serverInfo.getUuid()); builder.name(serverInfo.getName()); builder.group(groupNamingConventionWithoutPrefix.extractGroup(serverInfo.getName())); builder.location(getOnlyElement(locations.get())); builder.hardware(new HardwareBuilder().ids(serverInfo.getUuid()).processor(new Processor(1, serverInfo.getCpu())) .ram(serverInfo.getMemory().intValue()) .volumes(Iterables.transform(serverInfo.getDrives(), serverDriveToVolume)).build()); builder.tags(readTags(serverInfo)); builder.userMetadata(serverInfo.getMeta()); builder.imageId(extractImageId(serverInfo)); builder.status(serverStatusToNodeStatus.get(serverInfo.getStatus())); builder.publicAddresses(filter(transform(serverInfo.getNics(), nicToAddress), notNull())); // CloudSigma does not provide a way to get the credentials. // Try to return them from the credential store Credentials credentials = credentialStore.get("node#" + serverInfo.getUuid()); if (credentials instanceof LoginCredentials) { builder.credentials(LoginCredentials.class.cast(credentials)); } return builder.build(); }
@Override public NodeMetadata apply(ServerInfo serverInfo) { NodeMetadataBuilder builder = new NodeMetadataBuilder(); builder.ids(serverInfo.getUuid()); builder.name(serverInfo.getName()); builder.group(groupNamingConventionWithoutPrefix.extractGroup(serverInfo.getName())); builder.location(getOnlyElement(locations.get())); builder.hardware(new HardwareBuilder().ids(serverInfo.getUuid()).processor(new Processor(1, serverInfo.getCpu())) .ram(serverInfo.getMemory().intValue()) .volumes(Iterables.transform(serverInfo.getDrives(), serverDriveToVolume)).build()); builder.tags(readTags(serverInfo)); builder.userMetadata(serverInfo.getMeta()); builder.imageId(extractImageId(serverInfo)); builder.status(serverStatusToNodeStatus.get(serverInfo.getStatus())); builder.publicAddresses(filter(transform(serverInfo.getNics(), nicToAddress), notNull())); // CloudSigma does not provide a way to get the credentials. // Try to return them from the credential store Credentials credentials = credentialStore.get("node#" + serverInfo.getUuid()); if (credentials instanceof LoginCredentials) { builder.credentials(LoginCredentials.class.cast(credentials)); } return builder.build(); }
builder.name(input.name()); builder.hostname(input.name()); builder.group(groupNamingConvention.extractGroup(input.name()));
builder.name(input.name()); builder.hostname(input.name()); builder.group(groupNamingConvention.extractGroup(input.name()));
builder.name(input.name()); builder.hostname(input.name()); builder.group(groupNamingConvention.extractGroup(input.name()));
@Override public NodeMetadata apply(Container container) { String name = cleanUpName(container.name()); String group = nodeNamingConvention.extractGroup(name); NodeMetadataBuilder builder = new NodeMetadataBuilder(); builder.ids(container.id()) .name(name) .group(group) .hostname(container.config().hostname()) // TODO Set up hardware .hardware(new HardwareBuilder() .id("") .ram(container.config().memory()) .processor(new Processor(container.config().cpuShares(), container.config().cpuShares())) .build()); builder.status(toPortableStatus.apply(container.state())); builder.loginPort(loginPortForContainer.apply(container).or(NO_LOGIN_PORT)); builder.publicAddresses(getPublicIpAddresses(container)); builder.privateAddresses(getPrivateIpAddresses(container)); builder.location(Iterables.getOnlyElement(locations.get())); String imageId = container.image(); builder.imageId(imageId); if (images.get().containsKey(imageId)) { Image image = images.get().get(imageId); builder.operatingSystem(image.getOperatingSystem()); } return builder.build(); }
@Override public NodeMetadata apply(Container container) { String name = cleanUpName(container.name()); String group = nodeNamingConvention.extractGroup(name); NodeMetadataBuilder builder = new NodeMetadataBuilder(); builder.ids(container.id()) .name(name) .group(group) .hostname(container.config().hostname()) // TODO Set up hardware .hardware(new HardwareBuilder() .id("") .ram(container.config().memory()) .processor(new Processor(container.config().cpuShares(), container.config().cpuShares())) .build()); builder.status(toPortableStatus.apply(container.state())); builder.loginPort(loginPortForContainer.apply(container).or(NO_LOGIN_PORT)); builder.publicAddresses(getPublicIpAddresses(container)); builder.privateAddresses(getPrivateIpAddresses(container)); builder.location(Iterables.getOnlyElement(locations.get())); String imageId = container.image(); builder.imageId(imageId); if (images.get().containsKey(imageId)) { Image image = images.get().get(imageId); builder.operatingSystem(image.getOperatingSystem()); } return builder.build(); }
@Override public NodeMetadata apply(Container container) { String name = cleanUpName(container.name()); String group = nodeNamingConvention.extractGroup(name); NodeMetadataBuilder builder = new NodeMetadataBuilder(); builder.ids(container.id()) .name(name) .group(group) .hostname(container.config().hostname()) // TODO Set up hardware .hardware(new HardwareBuilder() .id("") .ram(container.config().memory()) .processor(new Processor(container.config().cpuShares(), container.config().cpuShares())) .build()); builder.status(toPortableStatus.apply(container.state())); builder.loginPort(loginPortForContainer.apply(container).or(NO_LOGIN_PORT)); builder.publicAddresses(getPublicIpAddresses(container)); builder.privateAddresses(getPrivateIpAddresses(container)); builder.location(Iterables.getOnlyElement(locations.get())); String imageId = container.image(); builder.imageId(imageId); if (images.get().containsKey(imageId)) { Image image = images.get().get(imageId); builder.operatingSystem(image.getOperatingSystem()); } return builder.build(); }
@Override public NodeMetadata apply(Container container) { String name = cleanUpName(container.name()); String group = nodeNamingConvention.extractGroup(name); NodeMetadataBuilder builder = new NodeMetadataBuilder(); builder.ids(container.id()) .name(name) .group(group) .hostname(container.config().hostname()) // TODO Set up hardware .hardware(new HardwareBuilder() .id("") .ram(container.config().memory()) .processor(new Processor(container.config().cpuShares(), container.config().cpuShares())) .build()); builder.status(toPortableStatus.apply(container.state())); builder.loginPort(loginPortForContainer.apply(container).or(NO_LOGIN_PORT)); builder.publicAddresses(getPublicIpAddresses(container)); builder.privateAddresses(getPrivateIpAddresses(container)); builder.location(Iterables.getOnlyElement(locations.get())); String imageId = container.image(); builder.imageId(imageId); if (images.get().containsKey(imageId)) { Image image = images.get().get(imageId); builder.operatingSystem(image.getOperatingSystem()); } return builder.build(); }
.group(groupNamingConvention.extractGroup(server.name())) .hostname(server.hostname()) .name(server.name())
.group(groupNamingConvention.extractGroup(server.name())) .hostname(server.hostname()) .name(server.name())
@Override public NodeMetadata apply(Device input) { return new NodeMetadataBuilder() .ids(input.id()) .name(input.hostname()) .hostname(String.format("%s", input.hostname())) .group(groupNamingConvention.extractGroup(input.hostname())) .location(facilityToLocation.apply(input.facility())) .hardware(planToHardware.apply(input.plan())) .imageId(input.operatingSystem().slug()) .operatingSystem(operatingSystemToImage.apply(input.operatingSystem()).getOperatingSystem()) .status(toPortableStatus.apply(input.state())) .publicAddresses(getPublicIpAddresses(input.ipAddresses())) .privateAddresses(getPrivateIpAddresses(input.ipAddresses())) .tags(input.tags()) .build(); }
builder.group(groupFromMetadata != null ? groupFromMetadata : nodeNamingConvention.extractGroup(virtualMachine .name()));
builder.group(groupFromMetadata != null ? groupFromMetadata : nodeNamingConvention.extractGroup(virtualMachine .name()));