Search in sources :

Example 1 with OpenstackVolumeAuthenticationKey

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

the class OpenStackVolumeAuthenticationKeyMapper method map.

@Mapping(from = LibvirtSecret.class, to = OpenstackVolumeAuthenticationKey.class)
public static OpenstackVolumeAuthenticationKey map(LibvirtSecret entity, OpenstackVolumeAuthenticationKey template) {
    OpenstackVolumeAuthenticationKey model = template != null ? template : new OpenstackVolumeAuthenticationKey();
    if (entity.getId() != null) {
        model.setId(entity.getId().toString());
        model.setUuid(entity.getId().toString());
    }
    if (entity.getDescription() != null) {
        model.setDescription(entity.getDescription());
    }
    if (entity.getCreationDate() != null) {
        model.setCreationDate(DateMapper.map(entity.getCreationDate(), null));
    }
    if (entity.getUsageType() != null) {
        model.setUsageType(map(entity.getUsageType(), null));
    }
    if (entity.getProviderId() != null) {
        OpenStackVolumeProvider provider = new OpenStackVolumeProvider();
        provider.setId(entity.getProviderId().toString());
        model.setOpenstackVolumeProvider(provider);
    }
    return model;
}
Also used : OpenstackVolumeAuthenticationKey(org.ovirt.engine.api.model.OpenstackVolumeAuthenticationKey) OpenStackVolumeProvider(org.ovirt.engine.api.model.OpenStackVolumeProvider) Mapping(org.ovirt.engine.api.restapi.types.Mapping)

Example 2 with OpenstackVolumeAuthenticationKey

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

the class BackendOpenStackVolumeAuthenticationKeyResourceTest method getModel.

private OpenstackVolumeAuthenticationKey getModel(int index) {
    OpenstackVolumeAuthenticationKey model = new OpenstackVolumeAuthenticationKey();
    model.setId(GUIDS[index].toString());
    model.setDescription(DESCRIPTIONS[index]);
    OpenStackVolumeProvider provider = new OpenStackVolumeProvider();
    provider.setId(GUIDS[0].toString());
    model.setOpenstackVolumeProvider(provider);
    model.setUsageType(OpenstackVolumeAuthenticationKeyUsageType.CEPH);
    return model;
}
Also used : OpenstackVolumeAuthenticationKey(org.ovirt.engine.api.model.OpenstackVolumeAuthenticationKey) OpenStackVolumeProvider(org.ovirt.engine.api.model.OpenStackVolumeProvider)

Aggregations

OpenStackVolumeProvider (org.ovirt.engine.api.model.OpenStackVolumeProvider)2 OpenstackVolumeAuthenticationKey (org.ovirt.engine.api.model.OpenstackVolumeAuthenticationKey)2 Mapping (org.ovirt.engine.api.restapi.types.Mapping)1