Search in sources :

Example 1 with V3StorageDomain

use of org.ovirt.engine.api.v3.types.V3StorageDomain in project ovirt-engine by oVirt.

the class V3StorageDomainInAdapter method adapt.

@Override
public StorageDomain adapt(V3StorageDomain from) {
    StorageDomain to = new StorageDomain();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptIn(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetAvailable()) {
        to.setAvailable(from.getAvailable());
    }
    if (from.isSetComment()) {
        to.setComment(from.getComment());
    }
    if (from.isSetCommitted()) {
        to.setCommitted(from.getCommitted());
    }
    if (from.isSetCriticalSpaceActionBlocker()) {
        to.setCriticalSpaceActionBlocker(from.getCriticalSpaceActionBlocker());
    }
    if (from.isSetDataCenter()) {
        to.setDataCenter(adaptIn(from.getDataCenter()));
    }
    if (from.isSetDataCenters()) {
        to.setDataCenters(new DataCenters());
        to.getDataCenters().getDataCenters().addAll(adaptIn(from.getDataCenters().getDataCenters()));
    }
    if (from.isSetDescription()) {
        to.setDescription(from.getDescription());
    }
    if (from.isSetExternalStatus() && from.getExternalStatus().isSetState()) {
        to.setExternalStatus(ExternalStatus.fromValue(from.getExternalStatus().getState()));
    }
    if (from.isSetHost()) {
        to.setHost(adaptIn(from.getHost()));
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetImport()) {
        to.setImport(from.isImport());
    }
    if (from.isSetMaster()) {
        to.setMaster(from.isMaster());
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetStatus() && from.getStatus().isSetState()) {
        to.setStatus(StorageDomainStatus.fromValue(from.getStatus().getState()));
    }
    if (from.isSetStorage()) {
        to.setStorage(adaptIn(from.getStorage()));
    }
    if (from.isSetStorageFormat()) {
        to.setStorageFormat(StorageFormat.fromValue(from.getStorageFormat()));
    }
    if (from.isSetType()) {
        to.setType(StorageDomainType.fromValue(from.getType()));
    }
    if (from.isSetUsed()) {
        to.setUsed(from.getUsed());
    }
    if (from.isSetWarningLowSpaceIndicator()) {
        to.setWarningLowSpaceIndicator(from.getWarningLowSpaceIndicator());
    }
    if (from.isSetWipeAfterDelete()) {
        to.setWipeAfterDelete(from.isWipeAfterDelete());
    }
    return to;
}
Also used : StorageDomain(org.ovirt.engine.api.model.StorageDomain) V3StorageDomain(org.ovirt.engine.api.v3.types.V3StorageDomain) DataCenters(org.ovirt.engine.api.model.DataCenters)

Example 2 with V3StorageDomain

use of org.ovirt.engine.api.v3.types.V3StorageDomain in project ovirt-engine by oVirt.

the class V3StorageDomainOutAdapter method adapt.

@Override
public V3StorageDomain adapt(StorageDomain from) {
    V3StorageDomain to = new V3StorageDomain();
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptOut(from.getLinks()));
    }
    if (from.isSetActions()) {
        to.setActions(adaptOut(from.getActions()));
    }
    if (from.isSetAvailable()) {
        to.setAvailable(from.getAvailable());
    }
    if (from.isSetComment()) {
        to.setComment(from.getComment());
    }
    if (from.isSetCommitted()) {
        to.setCommitted(from.getCommitted());
    }
    if (from.isSetCriticalSpaceActionBlocker()) {
        to.setCriticalSpaceActionBlocker(from.getCriticalSpaceActionBlocker());
    }
    if (from.isSetDataCenter()) {
        to.setDataCenter(adaptOut(from.getDataCenter()));
    }
    if (from.isSetDataCenters()) {
        to.setDataCenters(new V3DataCenters());
        to.getDataCenters().getDataCenters().addAll(adaptOut(from.getDataCenters().getDataCenters()));
    }
    if (from.isSetDescription()) {
        to.setDescription(from.getDescription());
    }
    if (from.isSetExternalStatus()) {
        V3Status status = new V3Status();
        status.setState(from.getExternalStatus().value());
        to.setExternalStatus(status);
    }
    if (from.isSetHost()) {
        to.setHost(adaptOut(from.getHost()));
    }
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetImport()) {
        to.setImport(from.isImport());
    }
    if (from.isSetMaster()) {
        to.setMaster(from.isMaster());
    }
    if (from.isSetName()) {
        to.setName(from.getName());
    }
    if (from.isSetStatus()) {
        V3Status status = new V3Status();
        status.setState(from.getStatus().value());
        to.setStatus(status);
    }
    if (from.isSetStorage()) {
        to.setStorage(adaptOut(from.getStorage()));
    }
    if (from.isSetStorageFormat()) {
        to.setStorageFormat(from.getStorageFormat().value());
    }
    if (from.isSetType()) {
        to.setType(from.getType().value());
    }
    if (from.isSetUsed()) {
        to.setUsed(from.getUsed());
    }
    if (from.isSetWarningLowSpaceIndicator()) {
        to.setWarningLowSpaceIndicator(from.getWarningLowSpaceIndicator());
    }
    if (from.isSetWipeAfterDelete()) {
        to.setWipeAfterDelete(from.isWipeAfterDelete());
    }
    return to;
}
Also used : V3StorageDomain(org.ovirt.engine.api.v3.types.V3StorageDomain) V3DataCenters(org.ovirt.engine.api.v3.types.V3DataCenters) V3Status(org.ovirt.engine.api.v3.types.V3Status)

Example 3 with V3StorageDomain

use of org.ovirt.engine.api.v3.types.V3StorageDomain in project ovirt-engine by oVirt.

the class V3StorageDomainServer method remove.

@DELETE
@Consumes({ "application/xml", "application/json" })
public Response remove(V3StorageDomain storageDomain) {
    // to check if they are present in the body of the request and convert them into request parameters.
    if (storageDomain != null) {
        Map<String, String> parameters = CurrentManager.get().getParameters();
        if (storageDomain.isSetFormat()) {
            parameters.put("format", storageDomain.isFormat().toString());
        }
        if (storageDomain.isSetDestroy()) {
            parameters.put("destroy", storageDomain.isDestroy().toString());
        }
        V3Host host = storageDomain.getHost();
        if (host != null) {
            if (host.isSetId()) {
                parameters.put("host", host.getId());
            } else if (host.isSetName()) {
                parameters.put("host", host.getName());
            }
        }
    }
    return adaptRemove(getDelegate()::remove);
}
Also used : V3Host(org.ovirt.engine.api.v3.types.V3Host) DELETE(javax.ws.rs.DELETE) Consumes(javax.ws.rs.Consumes)

Aggregations

V3StorageDomain (org.ovirt.engine.api.v3.types.V3StorageDomain)2 Consumes (javax.ws.rs.Consumes)1 DELETE (javax.ws.rs.DELETE)1 DataCenters (org.ovirt.engine.api.model.DataCenters)1 StorageDomain (org.ovirt.engine.api.model.StorageDomain)1 V3DataCenters (org.ovirt.engine.api.v3.types.V3DataCenters)1 V3Host (org.ovirt.engine.api.v3.types.V3Host)1 V3Status (org.ovirt.engine.api.v3.types.V3Status)1