Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add service checks and node checks to session objects #220

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/main/java/com/ecwid/consul/v1/session/model/NewSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,19 @@ public class NewSession {
@SerializedName("Node")
private String node;

/**
* @deprecated this field is deprecated as of consul 1.7, the fields nodeChecks and serviceChecks should be used instead
*/
@Deprecated
@SerializedName("Checks")
private List<String> checks;

@SerializedName("NodeChecks")
private List<String> nodeChecks;

@SerializedName("ServiceChecks")
private List<ServiceCheck> serviceChecks;

@SerializedName("Behavior")
private Session.Behavior behavior;

Expand Down Expand Up @@ -59,6 +69,22 @@ public void setChecks(List<String> checks) {
this.checks = checks;
}

public List<String> getNodeChecks() {
return nodeChecks;
}

public void setNodeChecks(List<String> nodeChecks) {
this.nodeChecks = nodeChecks;
}

public List<ServiceCheck> getServiceChecks() {
return serviceChecks;
}

public void setServiceChecks(List<ServiceCheck> serviceChecks) {
this.serviceChecks = serviceChecks;
}

public Session.Behavior getBehavior() {
return behavior;
}
Expand Down
36 changes: 36 additions & 0 deletions src/main/java/com/ecwid/consul/v1/session/model/ServiceCheck.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.ecwid.consul.v1.session.model;

import com.google.gson.annotations.SerializedName;

public class ServiceCheck {

@SerializedName("ID")
private String id;

@SerializedName("Namespace")
private String namespace;

public String getId() {
return id;
}

public void setId(String id) {
this.id = id;
}

public String getNamespace() {
return namespace;
}

public void setNamespace(String namespace) {
this.namespace = namespace;
}

@Override
public String toString() {
return "ServiceCheck{" +
"id='" + id + '\'' +
", namespace='" + namespace + '\'' +
'}';
}
}
28 changes: 28 additions & 0 deletions src/main/java/com/ecwid/consul/v1/session/model/Session.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,19 @@ public static enum Behavior {
@SerializedName("LockDelay")
private long lockDelay;

/**
* @deprecated this field is deprecated as of consul 1.7, the fields nodeChecks and serviceChecks should be used instead
*/
@Deprecated
@SerializedName("Checks")
private List<String> checks;

@SerializedName("NodeChecks")
private List<String> nodeChecks;

@SerializedName("ServiceChecks")
private List<ServiceCheck> serviceChecks;

@SerializedName("Node")
private String node;

Expand Down Expand Up @@ -60,6 +70,22 @@ public void setChecks(List<String> checks) {
this.checks = checks;
}

public List<String> getNodeChecks() {
return nodeChecks;
}

public void setNodeChecks(List<String> nodeChecks) {
this.nodeChecks = nodeChecks;
}

public List<ServiceCheck> getServiceChecks() {
return serviceChecks;
}

public void setServiceChecks(List<ServiceCheck> serviceChecks) {
this.serviceChecks = serviceChecks;
}

public String getNode() {
return node;
}
Expand Down Expand Up @@ -121,6 +147,8 @@ public String toString() {
return "Session{" +
"lockDelay=" + lockDelay +
", checks=" + checks +
", nodeChecks=" + nodeChecks +
", serviceChecks=" + serviceChecks +
", node='" + node + '\'' +
", id='" + id + '\'' +
", name='" + name + '\'' +
Expand Down