Search in sources :

Example 1 with OpenStackVolumeProvider

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

the class BackendOpenStackVolumeAuthenticationKeysResource method addProvider.

private OpenstackVolumeAuthenticationKey addProvider(OpenstackVolumeAuthenticationKey authenticationKey) {
    OpenStackVolumeProvider provider = new OpenStackVolumeProvider();
    provider.setId(providerId);
    authenticationKey.setOpenstackVolumeProvider(provider);
    return authenticationKey;
}
Also used : OpenStackVolumeProvider(org.ovirt.engine.api.model.OpenStackVolumeProvider)

Example 2 with OpenStackVolumeProvider

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

the class BackendOpenStackVolumeTypesResource method addParents.

@Override
protected OpenStackVolumeType addParents(OpenStackVolumeType volumeType) {
    OpenStackVolumeProvider provider = new OpenStackVolumeProvider();
    provider.setId(providerId);
    volumeType.setOpenstackVolumeProvider(provider);
    return super.addParents(volumeType);
}
Also used : OpenStackVolumeProvider(org.ovirt.engine.api.model.OpenStackVolumeProvider)

Example 3 with OpenStackVolumeProvider

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

the class BackendOpenStackVolumeProviderResourceTest method getModel.

private OpenStackVolumeProvider getModel(int index) {
    OpenStackVolumeProvider model = new OpenStackVolumeProvider();
    model.setName(NAMES[index]);
    model.setDescription(DESCRIPTIONS[index]);
    return model;
}
Also used : OpenStackVolumeProvider(org.ovirt.engine.api.model.OpenStackVolumeProvider)

Example 4 with OpenStackVolumeProvider

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

the class BackendOpenStackVolumeProviderResourceTest method testConflictedUpdate.

@Test
public void testConflictedUpdate() throws Exception {
    setUriInfo(setUpBasicUriExpectations());
    setUpGetEntityExpectations(1);
    OpenStackVolumeProvider model = getModel(1);
    model.setId(GUIDS[1].toString());
    try {
        resource.update(model);
        fail("expected WebApplicationException");
    } catch (WebApplicationException wae) {
        verifyImmutabilityConstraint(wae);
    }
}
Also used : WebApplicationException(javax.ws.rs.WebApplicationException) OpenStackVolumeProvider(org.ovirt.engine.api.model.OpenStackVolumeProvider) Test(org.junit.Test) AbstractBackendSubResourceTest(org.ovirt.engine.api.restapi.resource.AbstractBackendSubResourceTest)

Example 5 with OpenStackVolumeProvider

use of org.ovirt.engine.api.model.OpenStackVolumeProvider 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)

Aggregations

OpenStackVolumeProvider (org.ovirt.engine.api.model.OpenStackVolumeProvider)11 OpenstackVolumeAuthenticationKey (org.ovirt.engine.api.model.OpenstackVolumeAuthenticationKey)2 Properties (org.ovirt.engine.api.model.Properties)2 Mapping (org.ovirt.engine.api.restapi.types.Mapping)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 WebApplicationException (javax.ws.rs.WebApplicationException)1 Test (org.junit.Test)1 DataCenter (org.ovirt.engine.api.model.DataCenter)1 OpenStackVolumeProviders (org.ovirt.engine.api.model.OpenStackVolumeProviders)1 Property (org.ovirt.engine.api.model.Property)1 AbstractBackendSubResourceTest (org.ovirt.engine.api.restapi.resource.AbstractBackendSubResourceTest)1 V3OpenStackVolumeProvider (org.ovirt.engine.api.v3.types.V3OpenStackVolumeProvider)1 Provider (org.ovirt.engine.core.common.businessentities.Provider)1 OpenStackVolumeProviderProperties (org.ovirt.engine.core.common.businessentities.storage.OpenStackVolumeProviderProperties)1