mirror of https://github.com/apache/jclouds.git
added loginPort to nodeMetadata, defaulting to port 22
This commit is contained in:
parent
e5315d3348
commit
26eb27fdd0
|
@ -70,6 +70,17 @@ public interface NodeMetadata extends ComputeMetadata {
|
||||||
*/
|
*/
|
||||||
NodeState getState();
|
NodeState getState();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the TCP port used for terminal connections. Generally, this is port 22 for ssh.
|
||||||
|
*/
|
||||||
|
int getLoginPort();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If possible, these are returned upon all detail requests. However, it is often the case that
|
||||||
|
* credentials are only available at "run" time.
|
||||||
|
*/
|
||||||
|
Credentials getCredentials();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All public IP addresses, potentially including shared ips.
|
* All public IP addresses, potentially including shared ips.
|
||||||
*/
|
*/
|
||||||
|
@ -80,10 +91,4 @@ public interface NodeMetadata extends ComputeMetadata {
|
||||||
*/
|
*/
|
||||||
Set<String> getPrivateAddresses();
|
Set<String> getPrivateAddresses();
|
||||||
|
|
||||||
/**
|
|
||||||
* If possible, these are returned upon all detail requests. However, it is often the case that
|
|
||||||
* credentials are only available at "run" time.
|
|
||||||
*/
|
|
||||||
Credentials getCredentials();
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -45,6 +45,7 @@ public class NodeMetadataBuilder extends ComputeMetadataBuilder {
|
||||||
private Credentials credentials;
|
private Credentials credentials;
|
||||||
@Nullable
|
@Nullable
|
||||||
private String tag;
|
private String tag;
|
||||||
|
private int loginPort;
|
||||||
@Nullable
|
@Nullable
|
||||||
private String imageId;
|
private String imageId;
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -56,6 +57,11 @@ public class NodeMetadataBuilder extends ComputeMetadataBuilder {
|
||||||
super(ComputeType.NODE);
|
super(ComputeType.NODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public NodeMetadataBuilder loginPort(int loginPort) {
|
||||||
|
this.loginPort = loginPort;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public NodeMetadataBuilder state(NodeState state) {
|
public NodeMetadataBuilder state(NodeState state) {
|
||||||
this.state = checkNotNull(state, "state");
|
this.state = checkNotNull(state, "state");
|
||||||
return this;
|
return this;
|
||||||
|
@ -134,14 +140,14 @@ public class NodeMetadataBuilder extends ComputeMetadataBuilder {
|
||||||
@Override
|
@Override
|
||||||
public NodeMetadata build() {
|
public NodeMetadata build() {
|
||||||
return new NodeMetadataImpl(providerId, name, id, location, uri, userMetadata, tag, hardware, imageId, os, state,
|
return new NodeMetadataImpl(providerId, name, id, location, uri, userMetadata, tag, hardware, imageId, os, state,
|
||||||
publicAddresses, privateAddresses, credentials);
|
loginPort, publicAddresses, privateAddresses, credentials);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static NodeMetadataBuilder fromNodeMetadata(NodeMetadata node) {
|
public static NodeMetadataBuilder fromNodeMetadata(NodeMetadata node) {
|
||||||
return new NodeMetadataBuilder().providerId(node.getProviderId()).name(node.getName()).id(node.getId())
|
return new NodeMetadataBuilder().providerId(node.getProviderId()).name(node.getName()).id(node.getId())
|
||||||
.location(node.getLocation()).uri(node.getUri()).userMetadata(node.getUserMetadata()).tag(node.getTag())
|
.location(node.getLocation()).uri(node.getUri()).userMetadata(node.getUserMetadata()).tag(node.getTag())
|
||||||
.hardware(node.getHardware()).imageId(node.getImageId()).operatingSystem(node.getOperatingSystem())
|
.hardware(node.getHardware()).imageId(node.getImageId()).operatingSystem(node.getOperatingSystem())
|
||||||
.state(node.getState()).publicAddresses(node.getPublicAddresses())
|
.state(node.getState()).loginPort(node.getLoginPort()).publicAddresses(node.getPublicAddresses())
|
||||||
.privateAddresses(node.getPrivateAddresses()).credentials(node.getCredentials());
|
.privateAddresses(node.getPrivateAddresses()).credentials(node.getCredentials());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,7 @@ public class NodeMetadataImpl extends ComputeMetadataImpl implements NodeMetadat
|
||||||
private static final long serialVersionUID = 7924307572338157887L;
|
private static final long serialVersionUID = 7924307572338157887L;
|
||||||
|
|
||||||
private final NodeState state;
|
private final NodeState state;
|
||||||
|
private final int loginPort;
|
||||||
private final Set<String> publicAddresses;
|
private final Set<String> publicAddresses;
|
||||||
private final Set<String> privateAddresses;
|
private final Set<String> privateAddresses;
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -62,7 +63,7 @@ public class NodeMetadataImpl extends ComputeMetadataImpl implements NodeMetadat
|
||||||
|
|
||||||
public NodeMetadataImpl(String providerId, String name, String id, Location location, URI uri,
|
public NodeMetadataImpl(String providerId, String name, String id, Location location, URI uri,
|
||||||
Map<String, String> userMetadata, @Nullable String tag, @Nullable Hardware hardware, @Nullable String imageId,
|
Map<String, String> userMetadata, @Nullable String tag, @Nullable Hardware hardware, @Nullable String imageId,
|
||||||
@Nullable OperatingSystem os, NodeState state, Iterable<String> publicAddresses,
|
@Nullable OperatingSystem os, NodeState state, int loginPort, Iterable<String> publicAddresses,
|
||||||
Iterable<String> privateAddresses, @Nullable Credentials credentials) {
|
Iterable<String> privateAddresses, @Nullable Credentials credentials) {
|
||||||
super(ComputeType.NODE, providerId, name, id, location, uri, userMetadata);
|
super(ComputeType.NODE, providerId, name, id, location, uri, userMetadata);
|
||||||
this.tag = tag;
|
this.tag = tag;
|
||||||
|
@ -70,6 +71,7 @@ public class NodeMetadataImpl extends ComputeMetadataImpl implements NodeMetadat
|
||||||
this.imageId = imageId;
|
this.imageId = imageId;
|
||||||
this.os = os;
|
this.os = os;
|
||||||
this.state = checkNotNull(state, "state");
|
this.state = checkNotNull(state, "state");
|
||||||
|
this.loginPort = loginPort;
|
||||||
this.publicAddresses = ImmutableSet.copyOf(checkNotNull(publicAddresses, "publicAddresses"));
|
this.publicAddresses = ImmutableSet.copyOf(checkNotNull(publicAddresses, "publicAddresses"));
|
||||||
this.privateAddresses = ImmutableSet.copyOf(checkNotNull(privateAddresses, "privateAddresses"));
|
this.privateAddresses = ImmutableSet.copyOf(checkNotNull(privateAddresses, "privateAddresses"));
|
||||||
this.credentials = credentials;
|
this.credentials = credentials;
|
||||||
|
@ -123,6 +125,14 @@ public class NodeMetadataImpl extends ComputeMetadataImpl implements NodeMetadat
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int getLoginPort() {
|
||||||
|
return this.loginPort;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
@ -143,15 +153,17 @@ public class NodeMetadataImpl extends ComputeMetadataImpl implements NodeMetadat
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "[id=" + getId() + ", providerId=" + getProviderId() + ", tag=" + getTag() + ", name=" + getName()
|
return "[id=" + getId() + ", providerId=" + getProviderId() + ", tag=" + getTag() + ", name=" + getName()
|
||||||
+ ", location=" + getLocation() + ", uri=" + getUri() + ", imageId=" + getImageId() + ", os="
|
+ ", location=" + getLocation() + ", uri=" + getUri() + ", imageId=" + getImageId() + ", os="
|
||||||
+ getOperatingSystem() + ", state=" + getState() + ", privateAddresses=" + privateAddresses
|
+ getOperatingSystem() + ", state=" + getState() + ", loginPort=" + getLoginPort() + ", privateAddresses="
|
||||||
+ ", publicAddresses=" + publicAddresses + ", hardware=" + getHardware() + ", loginUser="
|
+ privateAddresses + ", publicAddresses=" + publicAddresses + ", hardware=" + getHardware()
|
||||||
+ ((credentials != null) ? credentials.identity : null) + ", userMetadata=" + getUserMetadata() + "]";
|
+ ", loginUser=" + ((credentials != null) ? credentials.identity : null) + ", userMetadata="
|
||||||
|
+ getUserMetadata() + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
final int prime = 31;
|
final int prime = 31;
|
||||||
int result = super.hashCode();
|
int result = super.hashCode();
|
||||||
|
result = prime * result + loginPort;
|
||||||
result = prime * result + ((privateAddresses == null) ? 0 : privateAddresses.hashCode());
|
result = prime * result + ((privateAddresses == null) ? 0 : privateAddresses.hashCode());
|
||||||
result = prime * result + ((publicAddresses == null) ? 0 : publicAddresses.hashCode());
|
result = prime * result + ((publicAddresses == null) ? 0 : publicAddresses.hashCode());
|
||||||
result = prime * result + ((tag == null) ? 0 : tag.hashCode());
|
result = prime * result + ((tag == null) ? 0 : tag.hashCode());
|
||||||
|
@ -171,6 +183,8 @@ public class NodeMetadataImpl extends ComputeMetadataImpl implements NodeMetadat
|
||||||
if (getClass() != obj.getClass())
|
if (getClass() != obj.getClass())
|
||||||
return false;
|
return false;
|
||||||
NodeMetadataImpl other = (NodeMetadataImpl) obj;
|
NodeMetadataImpl other = (NodeMetadataImpl) obj;
|
||||||
|
if (loginPort != other.loginPort)
|
||||||
|
return false;
|
||||||
if (privateAddresses == null) {
|
if (privateAddresses == null) {
|
||||||
if (other.privateAddresses != null)
|
if (other.privateAddresses != null)
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue