Search in sources :

Example 1 with Certificates

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

the class AbstractBackendExternalProviderResource method importCertificates.

@Override
public Response importCertificates(Action action) {
    Provider provider = BackendExternalProviderHelper.getProvider(this, id);
    validateParameters(action, "certificates.content");
    String content = null;
    Certificates certificates = action.getCertificates();
    if (certificates != null) {
        List<Certificate> list = certificates.getCertificates();
        if (!CollectionUtils.isEmpty(list)) {
            content = list.get(0).getContent();
        }
    }
    return performAction(ActionType.ImportProviderCertificate, new ImportProviderCertificateParameters(provider, content));
}
Also used : Certificates(org.ovirt.engine.api.model.Certificates) ImportProviderCertificateParameters(org.ovirt.engine.core.common.action.ImportProviderCertificateParameters) Provider(org.ovirt.engine.core.common.businessentities.Provider) ExternalProvider(org.ovirt.engine.api.model.ExternalProvider) Certificate(org.ovirt.engine.api.model.Certificate)

Example 2 with Certificates

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

the class BackendExternalProviderCertificatesResource method mapCollection.

protected Certificates mapCollection(List<CertificateInfo> entities) {
    Certificates collection = new Certificates();
    if (entities != null) {
        for (int i = 0; i < entities.size(); i++) {
            CertificateInfo entity = entities.get(i);
            Certificate model = populate(map(entity), entity);
            model.setId(String.valueOf(i));
            collection.getCertificates().add(model);
        }
    }
    return collection;
}
Also used : Certificates(org.ovirt.engine.api.model.Certificates) CertificateInfo(org.ovirt.engine.core.common.businessentities.CertificateInfo) Certificate(org.ovirt.engine.api.model.Certificate)

Example 3 with Certificates

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

the class V3CertificatesInAdapter method adapt.

@Override
public Certificates adapt(V3Certificates from) {
    Certificates to = new Certificates();
    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.getCertificates().addAll(adaptIn(from.getCertificates()));
    return to;
}
Also used : V3Certificates(org.ovirt.engine.api.v3.types.V3Certificates) Certificates(org.ovirt.engine.api.model.Certificates)

Aggregations

Certificates (org.ovirt.engine.api.model.Certificates)3 Certificate (org.ovirt.engine.api.model.Certificate)2 ExternalProvider (org.ovirt.engine.api.model.ExternalProvider)1 V3Certificates (org.ovirt.engine.api.v3.types.V3Certificates)1 ImportProviderCertificateParameters (org.ovirt.engine.core.common.action.ImportProviderCertificateParameters)1 CertificateInfo (org.ovirt.engine.core.common.businessentities.CertificateInfo)1 Provider (org.ovirt.engine.core.common.businessentities.Provider)1