Skip to content

Commit

Permalink
Merge pull request ContainX#4 from emjburns/lbaasv2
Browse files Browse the repository at this point in the history
Health monitor working
  • Loading branch information
emjburns authored Jul 26, 2016
2 parents 4d874a8 + 7867fb5 commit 4c7756c
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.openstack4j.common.Buildable;
import org.openstack4j.model.ModelEntity;
import org.openstack4j.model.network.ext.builder.HealthMonitorV2Builder;
import org.openstack4j.openstack.networking.domain.ext.ListItem;

import java.util.List;

Expand All @@ -27,7 +28,7 @@ public interface HealthMonitorV2 extends ModelEntity, Buildable<HealthMonitorV2B
* @return type The type of probe sent by the load balancer to verify the
* member state, which is TCP, HTTP, or HTTPS.
*/
HealthMonitorV2Type getType();
HealthMonitorType getType();

/**
* @return delay The time, in seconds, between sending probes to members.
Expand Down Expand Up @@ -83,6 +84,6 @@ public interface HealthMonitorV2 extends ModelEntity, Buildable<HealthMonitorV2B
* The pools that this health monitor will monitor.
* @return pools
*/
List<LbPoolV2> getPools();
List<ListItem> getPools();

}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
package org.openstack4j.model.network.ext.builder;

import org.openstack4j.common.Buildable;
import org.openstack4j.model.network.ext.HealthMonitorType;
import org.openstack4j.model.network.ext.HealthMonitorV2;
import org.openstack4j.model.network.ext.HealthMonitorV2Type;
import org.openstack4j.model.network.ext.LbPoolV2;

import java.util.List;

public interface HealthMonitorV2Builder extends Buildable.Builder<HealthMonitorV2Builder, HealthMonitorV2> {
/**
Expand All @@ -24,7 +21,7 @@ public interface HealthMonitorV2Builder extends Buildable.Builder<HealthMonitorV
* sent by the health monitor to verify the member state.
* @return HealthMonitorV2Builder
*/
HealthMonitorV2Builder type(HealthMonitorV2Type type);
HealthMonitorV2Builder type(HealthMonitorType type);

/**
*
Expand Down Expand Up @@ -52,11 +49,11 @@ public interface HealthMonitorV2Builder extends Buildable.Builder<HealthMonitorV

/**
*
* @param pools
* List of pools that this health monitor will monitor
* @param poolId
* Pool that this health monitor is assigned to
* @return HealthMonitorV2Builder
*/
HealthMonitorV2Builder pools(List<LbPoolV2> pools);
HealthMonitorV2Builder poolId(String poolId);

/**
* Optional
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package org.openstack4j.openstack.networking.domain.ext;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.Objects;

@JsonAutoDetect
public class ListItem {
@JsonProperty("id")
String id;
Expand All @@ -20,4 +23,11 @@ public String getId(){
public void setId(String id){
this.id = id;
}

@Override
public String toString(){
return Objects.toStringHelper(this)
.add("id", id)
.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
import com.google.common.base.Objects;
import org.openstack4j.model.network.ext.HealthMonitorType;
import org.openstack4j.model.network.ext.HealthMonitorV2;
import org.openstack4j.model.network.ext.HealthMonitorV2Type;
import org.openstack4j.model.network.ext.LbPoolV2;
import org.openstack4j.model.network.ext.builder.HealthMonitorV2Builder;
import org.openstack4j.openstack.common.ListResult;

Expand All @@ -24,7 +23,7 @@ public class NeutronHealthMonitorV2 implements HealthMonitorV2{
@JsonProperty("tenant_id")
private String tenantId;

private HealthMonitorV2Type type;
private HealthMonitorType type;
private Integer delay;
private Integer timeout;

Expand All @@ -50,15 +49,18 @@ public class NeutronHealthMonitorV2 implements HealthMonitorV2{
* default 200
*/
@JsonProperty("expected_codes")
private String expectedCodes ;
private String expectedCodes;

/**
* The administrative state of the health monitor, which is up (true) or down (false)
*/
@JsonProperty("admin_state_up")
private boolean adminStateUp ;

private List<LbPoolV2> pools;
private List<ListItem> pools;

@JsonProperty("pool_id")
private String poolId;

@Override
public String getId(){
Expand All @@ -71,7 +73,7 @@ public String getTenantId(){
}

@Override
public HealthMonitorV2Type getType(){
public HealthMonitorType getType(){
return type;
}

Expand Down Expand Up @@ -111,11 +113,10 @@ public boolean isAdminStateUp(){
}

@Override
public List<LbPoolV2> getPools(){
public List<ListItem> getPools(){
return pools;
}


/**
* wrap this healthMonitorV2 to a builder
* @return HealthMonitorV2Builder
Expand Down Expand Up @@ -151,7 +152,7 @@ public String toString(){

public static class HealthMonitorsV2 extends ListResult<NeutronHealthMonitorV2> {

@JsonProperty("health_monitors_v2")
@JsonProperty("healthmonitors")
List<NeutronHealthMonitorV2> healthMonitors;
@Override
public List<NeutronHealthMonitorV2> value() {
Expand All @@ -160,7 +161,7 @@ public List<NeutronHealthMonitorV2> value() {
@Override
public String toString() {
return Objects.toStringHelper(this).omitNullValues()
.add("healthMonitorsV2", healthMonitors).toString();
.add("healthMonitors", healthMonitors).toString();
}
}

Expand Down Expand Up @@ -196,7 +197,7 @@ public HealthMonitorV2Builder tenantId(String tenantId) {
* {@inheritDoc}
*/
@Override
public HealthMonitorV2Builder type(HealthMonitorV2Type type) {
public HealthMonitorV2Builder type(HealthMonitorType type) {
m.type = type;
return this;
}
Expand Down Expand Up @@ -276,8 +277,8 @@ public HealthMonitorV2Builder adminStateUp(boolean adminStateUp) {
* {@inheritDoc}
*/
@Override
public HealthMonitorV2Builder pools(List<LbPoolV2> pools) {
m.pools = pools;
public HealthMonitorV2Builder poolId(String poolId){
m.poolId = poolId;
return this;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import org.openstack4j.openstack.compute.functions.ToActionResponseFunction;
import org.openstack4j.openstack.networking.domain.ext.NeutronListenerV2;
import org.openstack4j.openstack.networking.internal.BaseNetworkingServices;

import java.util.List;
import java.util.Map;

Expand All @@ -18,7 +17,6 @@
* @author emjburns
*/
public class ListenerServiceImpl extends BaseNetworkingServices implements ListenerService{

/**
* {@inheritDoc}
*/
Expand Down Expand Up @@ -67,7 +65,6 @@ public ActionResponse delete(String listenerId){
public Listener create(Listener listener){
checkNotNull(listener);
return post(NeutronListenerV2.class, uri("lbaas/listeners")).entity(listener).execute();

}

@Override
Expand Down

0 comments on commit 4c7756c

Please sign in to comment.