Search in sources :

Example 1 with OpenStackLoadBalancerMember

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

the class OpenStackNetworkService method getLoadBalancerMemberById.

/**
 * @see com.att.cdp.zones.NetworkService#getLoadBalancerMemberById(java.lang.String)
 */
@SuppressWarnings("nls")
@Override
public LoadBalancerMember getLoadBalancerMemberById(String id) throws ZoneException {
    checkArg(id, "id");
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.LOADBALANCERMEMBER, id);
    RequestState.put(RequestState.SERVICE, "Network");
    RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
    try {
        com.woorea.openstack.quantum.model.LoadBalancerMember n = quantumConnector.getClient().lbaas().Member().show(id).execute();
        return new OpenStackLoadBalancerMember(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) OpenStackLoadBalancerMember(com.att.cdp.openstack.model.OpenStackLoadBalancerMember)

Example 2 with OpenStackLoadBalancerMember

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

the class OpenStackNetworkService method getLoadBalancerMembers.

/**
 * @see com.att.cdp.zones.NetworkService#getLoadBalancerMembers()
 */
@Override
public List<LoadBalancerMember> getLoadBalancerMembers() throws ZoneException {
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.SERVICE, "Network");
    RequestState.put(RequestState.SERVICE_URL, quantumConnector.getEndpoint());
    ArrayList<LoadBalancerMember> list = new ArrayList<>();
    try {
        Quantum client = quantumConnector.getClient();
        LoadBalancerResource.Member resource = client.lbaas().Member();
        for (com.woorea.openstack.quantum.model.LoadBalancerMember loadBalancerMember : resource.list().execute()) {
            list.add(new OpenStackLoadBalancerMember(context, loadBalancerMember));
        }
    } 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) LoadBalancerResource(com.woorea.openstack.quantum.api.LoadBalancerResource) OpenStackLoadBalancerMember(com.att.cdp.openstack.model.OpenStackLoadBalancerMember) LoadBalancerMember(com.att.cdp.zones.model.LoadBalancerMember) Quantum(com.woorea.openstack.quantum.Quantum) OpenStackLoadBalancerMember(com.att.cdp.openstack.model.OpenStackLoadBalancerMember)

Example 3 with OpenStackLoadBalancerMember

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

the class OpenStackNetworkService method createLoadBalancerMember.

/**
 * @see com.att.cdp.zones.NetworkService#createLoadBalancerMember(com.att.cdp.zones.model.LoadBalancerMember)
 */
@Override
public LoadBalancerMember createLoadBalancerMember(LoadBalancerMember loadBalancerMember) 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.LoadBalancerMember loadBalancerMemberToCreate = new com.woorea.openstack.quantum.model.LoadBalancerMember();
        loadBalancerMemberToCreate.setAddress(loadBalancerMember.getAddress());
        loadBalancerMemberToCreate.setPort(loadBalancerMember.getProtocolPort());
        loadBalancerMemberToCreate.setPoolId(loadBalancerMember.getPoolId());
        loadBalancerMemberToCreate.setWeight(loadBalancerMember.getWeight());
        com.woorea.openstack.quantum.model.LoadBalancerMember openstackLbMember = client.lbaas().Member().create(loadBalancerMemberToCreate).execute();
        return new OpenStackLoadBalancerMember(context, openstackLbMember);
    } 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) OpenStackLoadBalancerMember(com.att.cdp.openstack.model.OpenStackLoadBalancerMember) LoadBalancerMember(com.att.cdp.zones.model.LoadBalancerMember) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException) OpenStackLoadBalancerMember(com.att.cdp.openstack.model.OpenStackLoadBalancerMember)

Example 4 with OpenStackLoadBalancerMember

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

the class OpenStackNetworkService method updateLoadBalancerMember.

/**
 * @see com.att.cdp.zones.NetworkService#updateLoadBalancerMember(com.att.cdp.zones.model.LoadBalancerMember)
 */
@Override
public LoadBalancerMember updateLoadBalancerMember(LoadBalancerMember loadBalancerMember) 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.LoadBalancerMember loadBalancerMemberToCreate = new com.woorea.openstack.quantum.model.LoadBalancerMember();
        loadBalancerMemberToCreate.setAddress(loadBalancerMember.getAddress());
        loadBalancerMemberToCreate.setPort(loadBalancerMember.getProtocolPort());
        loadBalancerMemberToCreate.setSubnetId(loadBalancerMember.getSubnetId());
        com.woorea.openstack.quantum.model.LoadBalancerMember openstackLbMember = client.lbaas().Member().update(loadBalancerMemberToCreate).execute();
        return new OpenStackLoadBalancerMember(context, openstackLbMember);
    } 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) OpenStackLoadBalancerMember(com.att.cdp.openstack.model.OpenStackLoadBalancerMember) LoadBalancerMember(com.att.cdp.zones.model.LoadBalancerMember) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException) OpenStackLoadBalancerMember(com.att.cdp.openstack.model.OpenStackLoadBalancerMember)

Aggregations

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