Search in sources :

Example 1 with Networks

use of org.ovirt.engine.api.model.Networks in project ovirt-engine by oVirt.

the class V3NetworksInAdapter method adapt.

@Override
public Networks adapt(V3Networks from) {
    Networks to = new Networks();
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetActive()) {
        to.setActive(from.getActive());
    }
    if (from.isSetSize()) {
        to.setSize(from.getSize());
    }
    if (from.isSetTotal()) {
        to.setTotal(from.getTotal());
    }
    to.getNetworks().addAll(adaptIn(from.getNetworks()));
    return to;
}
Also used : V3Networks(org.ovirt.engine.api.v3.types.V3Networks) Networks(org.ovirt.engine.api.model.Networks)

Example 2 with Networks

use of org.ovirt.engine.api.model.Networks in project ovirt-engine by oVirt.

the class V3IscsiBondInAdapter method adapt.

@Override
public IscsiBond adapt(V3IscsiBond from) {
    IscsiBond to = new IscsiBond();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptIn(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetComment()) {
        to.setComment(from.getComment());
    }
    if (from.isSetDataCenter()) {
        to.setDataCenter(adaptIn(from.getDataCenter()));
    }
    if (from.isSetDescription()) {
        to.setDescription(from.getDescription());
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetNetworks()) {
        to.setNetworks(new Networks());
        to.getNetworks().getNetworks().addAll(adaptIn(from.getNetworks().getNetworks()));
    }
    if (from.isSetStorageConnections()) {
        to.setStorageConnections(new StorageConnections());
        to.getStorageConnections().getStorageConnections().addAll(adaptIn(from.getStorageConnections().getStorageConnections()));
    }
    return to;
}
Also used : Networks(org.ovirt.engine.api.model.Networks) IscsiBond(org.ovirt.engine.api.model.IscsiBond) V3IscsiBond(org.ovirt.engine.api.v3.types.V3IscsiBond) StorageConnections(org.ovirt.engine.api.model.StorageConnections)

Example 3 with Networks

use of org.ovirt.engine.api.model.Networks in project ovirt-engine by oVirt.

the class BackendVirtualFunctionAllowedNetworkResource method get.

@Override
public Network get() {
    final Networks networks = getParent().list();
    final Network network = networks.getNetworks().stream().filter(n -> n.getId().equals(id)).findFirst().orElse(null);
    if (network == null) {
        notFound();
    }
    return network;
}
Also used : Networks(org.ovirt.engine.api.model.Networks) Network(org.ovirt.engine.api.model.Network)

Example 4 with Networks

use of org.ovirt.engine.api.model.Networks in project ovirt-engine by oVirt.

the class BackendVirtualFunctionAllowedNetworksResource method list.

@Override
public Networks list() {
    final Set<Guid> networkIds = loadVfAllowedNetworks();
    final Networks networks = new Networks();
    for (Guid networkId : networkIds) {
        final Network network = new Network();
        network.setId(networkId.toString());
        networks.getNetworks().add(network);
        addLinks(network);
    }
    return networks;
}
Also used : Networks(org.ovirt.engine.api.model.Networks) Network(org.ovirt.engine.api.model.Network) Guid(org.ovirt.engine.core.compat.Guid)

Example 5 with Networks

use of org.ovirt.engine.api.model.Networks in project ovirt-engine by oVirt.

the class IscsiBondMapper method map.

@Mapping(from = org.ovirt.engine.core.common.businessentities.IscsiBond.class, to = IscsiBond.class)
public static IscsiBond map(org.ovirt.engine.core.common.businessentities.IscsiBond from, IscsiBond to) {
    IscsiBond iscsiBond = (to != null) ? to : new IscsiBond();
    DataCenter dataCenter = new DataCenter();
    dataCenter.setId(from.getStoragePoolId().toString());
    iscsiBond.setDataCenter(dataCenter);
    iscsiBond.setName(from.getName());
    iscsiBond.setDescription(from.getDescription());
    if (from.getId() != null) {
        iscsiBond.setId(from.getId().toString());
    }
    Networks networks = new Networks();
    for (Guid id : from.getNetworkIds()) {
        Network network = new Network();
        network.setId(id.toString());
        networks.getNetworks().add(network);
    }
    iscsiBond.setNetworks(networks);
    StorageConnections connections = new StorageConnections();
    for (String id : from.getStorageConnectionIds()) {
        StorageConnection conn = new StorageConnection();
        conn.setId(id);
        connections.getStorageConnections().add(conn);
    }
    iscsiBond.setStorageConnections(connections);
    return iscsiBond;
}
Also used : Networks(org.ovirt.engine.api.model.Networks) DataCenter(org.ovirt.engine.api.model.DataCenter) Network(org.ovirt.engine.api.model.Network) IscsiBond(org.ovirt.engine.api.model.IscsiBond) Guid(org.ovirt.engine.core.compat.Guid) StorageConnection(org.ovirt.engine.api.model.StorageConnection) StorageConnections(org.ovirt.engine.api.model.StorageConnections)

Aggregations

Networks (org.ovirt.engine.api.model.Networks)5 Network (org.ovirt.engine.api.model.Network)3 IscsiBond (org.ovirt.engine.api.model.IscsiBond)2 StorageConnections (org.ovirt.engine.api.model.StorageConnections)2 Guid (org.ovirt.engine.core.compat.Guid)2 DataCenter (org.ovirt.engine.api.model.DataCenter)1 StorageConnection (org.ovirt.engine.api.model.StorageConnection)1 V3IscsiBond (org.ovirt.engine.api.v3.types.V3IscsiBond)1 V3Networks (org.ovirt.engine.api.v3.types.V3Networks)1