mirror of https://github.com/apache/jclouds.git
modify code to parse yaml
This commit is contained in:
parent
ceaddcc57f
commit
0c9a70ca84
|
@ -19,6 +19,8 @@
|
||||||
|
|
||||||
package org.jclouds.byon;
|
package org.jclouds.byon;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
@ -29,16 +31,16 @@ import com.google.common.base.Objects;
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public class Node {
|
public class Node {
|
||||||
private String id;
|
public String id;
|
||||||
private String description;
|
public String description;
|
||||||
private String hostname;
|
public String hostname;
|
||||||
private String osArch;
|
public String osArch;
|
||||||
private String osFamily;
|
public String osFamily;
|
||||||
private String osName;
|
public String osName;
|
||||||
private String osVersion;
|
public String osVersion;
|
||||||
private Set<String> tags;
|
public List<String> tags;
|
||||||
private String username;
|
public String username;
|
||||||
private String credential;
|
public String credential;
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
|
@ -69,7 +71,10 @@ public class Node {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> getTags() {
|
public Set<String> getTags() {
|
||||||
return tags;
|
Set<String> tagSet = new HashSet<String>();
|
||||||
|
for (String tag : tags)
|
||||||
|
tagSet.add(tag);
|
||||||
|
return tagSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUsername() {
|
public String getUsername() {
|
||||||
|
|
|
@ -69,6 +69,10 @@ public class BYONComputeServiceContextModule extends
|
||||||
public Map<String, Node> get() {
|
public Map<String, Node> get() {
|
||||||
Constructor constructor = new Constructor(Config.class);
|
Constructor constructor = new Constructor(Config.class);
|
||||||
|
|
||||||
|
TypeDescription nodeDesc = new TypeDescription(Node.class);
|
||||||
|
nodeDesc.putListPropertyType("tags", String.class);
|
||||||
|
constructor.addTypeDescription(nodeDesc);
|
||||||
|
|
||||||
TypeDescription configDesc = new TypeDescription(Config.class);
|
TypeDescription configDesc = new TypeDescription(Config.class);
|
||||||
configDesc.putMapPropertyType("nodes", String.class, Node.class);
|
configDesc.putMapPropertyType("nodes", String.class, Node.class);
|
||||||
constructor.addTypeDescription(configDesc);
|
constructor.addTypeDescription(configDesc);
|
||||||
|
|
|
@ -62,8 +62,12 @@ public class NodeToNodeMetadata implements Function<Node, NodeMetadata> {
|
||||||
builder.location(location.get());
|
builder.location(location.get());
|
||||||
builder.tag(Iterables.get(from.getTags(), 0));
|
builder.tag(Iterables.get(from.getTags(), 0));
|
||||||
builder
|
builder
|
||||||
.operatingSystem(new OperatingSystemBuilder().arch(from.getOsArch())
|
.operatingSystem(new OperatingSystemBuilder()
|
||||||
.family(OsFamily.fromValue(from.getOsFamily())).name(from.getOsName()).version(from.getOsVersion())
|
.arch(from.getOsArch())
|
||||||
|
.family(OsFamily.fromValue(from.getOsFamily()))
|
||||||
|
.name(from.getOsName())
|
||||||
|
.version(from.getOsVersion())
|
||||||
|
.description(from.getDescription())
|
||||||
.build());
|
.build());
|
||||||
builder.state(NodeState.RUNNING);
|
builder.state(NodeState.RUNNING);
|
||||||
builder.publicAddresses(ImmutableSet.<String> of(from.getHostname()));
|
builder.publicAddresses(ImmutableSet.<String> of(from.getHostname()));
|
||||||
|
|
Loading…
Reference in New Issue