Search in sources :

Example 1 with OpenStackLoadBalancerHealthMonitor

use of com.att.cdp.openstack.model.OpenStackLoadBalancerHealthMonitor in project AJSC by att.

the class OpenStackNetworkService method createLoadBalancerHealthMonitor.

/**
 * @see com.att.cdp.zones.NetworkService#createLoadBalancerHealthMonitor(com.att.cdp.zones.model.LoadBalancerHealthMonitor)
 */
@Override
public LoadBalancerHealthMonitor createLoadBalancerHealthMonitor(LoadBalancerHealthMonitor loadBalancerHealthMonitor) throws ZoneException {
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.SERVICE, "Network");
    RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
    try {
        Quantum client = quantumConnector.getClient();
        com.woorea.openstack.quantum.model.LoadBalancerHealthMonitor loadBalancerHealthMonitorToCreate = new com.woorea.openstack.quantum.model.LoadBalancerHealthMonitor();
        if (loadBalancerHealthMonitor.getType() != null) {
            loadBalancerHealthMonitorToCreate.setType(loadBalancerHealthMonitor.getType().name());
        }
        loadBalancerHealthMonitorToCreate.setDelay(loadBalancerHealthMonitor.getDelay());
        loadBalancerHealthMonitorToCreate.setTimeout(loadBalancerHealthMonitor.getTimeout());
        loadBalancerHealthMonitorToCreate.setMaxRetries(loadBalancerHealthMonitor.getMaxRetries());
        loadBalancerHealthMonitorToCreate.setUrlPath(loadBalancerHealthMonitor.getUrlPath());
        loadBalancerHealthMonitorToCreate.setExpectedCodes(loadBalancerHealthMonitor.getExpectedCodes());
        com.woorea.openstack.quantum.model.LoadBalancerHealthMonitor openstackLbMonitor = client.lbaas().HealthMonitor().create(loadBalancerHealthMonitorToCreate).execute();
        return new OpenStackLoadBalancerHealthMonitor(context, openstackLbMonitor);
    } catch (OpenStackBaseException e) {
        ExceptionMapper.mapException(e);
    }
    return null;
}
Also used : Context(com.att.cdp.zones.Context) OpenStackContext(com.att.cdp.openstack.OpenStackContext) Quantum(com.woorea.openstack.quantum.Quantum) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException) OpenStackLoadBalancerHealthMonitor(com.att.cdp.openstack.model.OpenStackLoadBalancerHealthMonitor) LoadBalancerHealthMonitor(com.att.cdp.zones.model.LoadBalancerHealthMonitor) OpenStackLoadBalancerHealthMonitor(com.att.cdp.openstack.model.OpenStackLoadBalancerHealthMonitor)

Example 2 with OpenStackLoadBalancerHealthMonitor

use of com.att.cdp.openstack.model.OpenStackLoadBalancerHealthMonitor in project AJSC by att.

the class OpenStackNetworkService method getLoadBalancerHealthMonitors.

/**
 * @see com.att.cdp.zones.NetworkService#getLoadBalancerHealthMonitors()
 */
@Override
public List<LoadBalancerHealthMonitor> getLoadBalancerHealthMonitors() throws ZoneException {
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.SERVICE, "Network");
    RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
    ArrayList<LoadBalancerHealthMonitor> list = new ArrayList<>();
    try {
        Quantum client = quantumConnector.getClient();
        LoadBalancerResource.HealthMonitor resource = client.lbaas().HealthMonitor();
        for (com.woorea.openstack.quantum.model.LoadBalancerHealthMonitor loadBalancerHealthMonitor : resource.list().execute()) {
            list.add(new OpenStackLoadBalancerHealthMonitor(context, loadBalancerHealthMonitor));
        }
    } catch (OpenStackBaseException e) {
        ExceptionMapper.mapException(e);
    }
    return list;
}
Also used : Context(com.att.cdp.zones.Context) OpenStackContext(com.att.cdp.openstack.OpenStackContext) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException) ArrayList(java.util.ArrayList) OpenStackLoadBalancerHealthMonitor(com.att.cdp.openstack.model.OpenStackLoadBalancerHealthMonitor) LoadBalancerHealthMonitor(com.att.cdp.zones.model.LoadBalancerHealthMonitor) LoadBalancerResource(com.woorea.openstack.quantum.api.LoadBalancerResource) Quantum(com.woorea.openstack.quantum.Quantum) OpenStackLoadBalancerHealthMonitor(com.att.cdp.openstack.model.OpenStackLoadBalancerHealthMonitor)

Example 3 with OpenStackLoadBalancerHealthMonitor

use of com.att.cdp.openstack.model.OpenStackLoadBalancerHealthMonitor in project AJSC by att.

the class OpenStackNetworkService method getLoadBalancerHealthMonitorById.

/**
 * @see com.att.cdp.zones.NetworkService#getLoadBalancerHealthMonitorById(java.lang.String)
 */
@SuppressWarnings("nls")
@Override
public LoadBalancerHealthMonitor getLoadBalancerHealthMonitorById(String id) throws ZoneException {
    checkArg(id, "id");
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.LOADBALANCERHEALTHMONITOR, id);
    RequestState.put(RequestState.SERVICE, "Network");
    RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
    try {
        com.woorea.openstack.quantum.model.LoadBalancerHealthMonitor n = quantumConnector.getClient().lbaas().HealthMonitor().show(id).execute();
        return new OpenStackLoadBalancerHealthMonitor(context, n);
    } catch (OpenStackBaseException ex) {
        ExceptionMapper.mapException(ex);
    }
    return null;
}
Also used : Context(com.att.cdp.zones.Context) OpenStackContext(com.att.cdp.openstack.OpenStackContext) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException) OpenStackLoadBalancerHealthMonitor(com.att.cdp.openstack.model.OpenStackLoadBalancerHealthMonitor)

Example 4 with OpenStackLoadBalancerHealthMonitor

use of com.att.cdp.openstack.model.OpenStackLoadBalancerHealthMonitor in project AJSC by att.

the class OpenStackNetworkService method updateLoadBalancerHealthMonitor.

/**
 * @see com.att.cdp.zones.NetworkService#updateLoadBalancerHealthMonitor(com.att.cdp.zones.model.LoadBalancerHealthMonitor)
 */
@SuppressWarnings("nls")
@Override
public LoadBalancerHealthMonitor updateLoadBalancerHealthMonitor(LoadBalancerHealthMonitor loadBalancerHealthMonitor) throws ZoneException {
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.SERVICE, "Network");
    RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
    try {
        Quantum client = quantumConnector.getClient();
        com.woorea.openstack.quantum.model.LoadBalancerHealthMonitor loadBalancerHealthMonitorToCreate = new com.woorea.openstack.quantum.model.LoadBalancerHealthMonitor();
        if (loadBalancerHealthMonitor.getType() != null) {
            loadBalancerHealthMonitorToCreate.setType(loadBalancerHealthMonitor.getType().name());
        }
        loadBalancerHealthMonitorToCreate.setDelay(loadBalancerHealthMonitor.getDelay());
        loadBalancerHealthMonitorToCreate.setTimeout(loadBalancerHealthMonitor.getTimeout());
        loadBalancerHealthMonitorToCreate.setMaxRetries(loadBalancerHealthMonitor.getMaxRetries());
        loadBalancerHealthMonitorToCreate.setUrlPath(loadBalancerHealthMonitor.getUrlPath());
        loadBalancerHealthMonitorToCreate.setExpectedCodes(loadBalancerHealthMonitor.getExpectedCodes());
        com.woorea.openstack.quantum.model.LoadBalancerHealthMonitor openstackLbMonitor = client.lbaas().HealthMonitor().update(loadBalancerHealthMonitorToCreate).execute();
        return new OpenStackLoadBalancerHealthMonitor(context, openstackLbMonitor);
    } catch (OpenStackBaseException e) {
        ExceptionMapper.mapException(e);
    }
    return null;
}
Also used : Context(com.att.cdp.zones.Context) OpenStackContext(com.att.cdp.openstack.OpenStackContext) Quantum(com.woorea.openstack.quantum.Quantum) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException) OpenStackLoadBalancerHealthMonitor(com.att.cdp.openstack.model.OpenStackLoadBalancerHealthMonitor) LoadBalancerHealthMonitor(com.att.cdp.zones.model.LoadBalancerHealthMonitor) OpenStackLoadBalancerHealthMonitor(com.att.cdp.openstack.model.OpenStackLoadBalancerHealthMonitor)

Aggregations

OpenStackContext (com.att.cdp.openstack.OpenStackContext)4 OpenStackLoadBalancerHealthMonitor (com.att.cdp.openstack.model.OpenStackLoadBalancerHealthMonitor)4 Context (com.att.cdp.zones.Context)4 OpenStackBaseException (com.woorea.openstack.base.client.OpenStackBaseException)4 LoadBalancerHealthMonitor (com.att.cdp.zones.model.LoadBalancerHealthMonitor)3 Quantum (com.woorea.openstack.quantum.Quantum)3 LoadBalancerResource (com.woorea.openstack.quantum.api.LoadBalancerResource)1 ArrayList (java.util.ArrayList)1