Search in sources :

Example 1 with LicenseInfoListExt

use of com.emc.storageos.systemservices.impl.licensing.LicenseInfoListExt in project coprhd-controller by CoprHD.

the class CallHomeServiceImpl method sendHeartbeatEvent.

@Override
public Response sendHeartbeatEvent() {
    // if not configured for callhome, do not continue.
    _callHomeEventManager.validateSendEvent();
    LicenseInfoListExt licenseList = null;
    try {
        licenseList = _licenseManager.getLicenseInfoListFromCoordinator();
    } catch (Exception e) {
        throw APIException.internalServerErrors.licenseInfoNotFoundForType("all license types");
    }
    if (licenseList != null) {
        // send heart beat events for each registered license type
        for (LicenseInfoExt licenseInfo : licenseList.getLicenseList()) {
            if (licenseInfo.isTrialLicense()) {
                _log.warn("Cannot send heartbeat event to SYR for trial license {} ", licenseInfo.getLicenseType().toString());
                throw APIException.forbidden.permissionDeniedForTrialLicense(licenseInfo.getLicenseType().toString());
            }
            _callHomeEventsFacade.sendHeartBeatEvent(licenseInfo, getMediaType());
        }
    }
    auditCallhome(OperationTypeEnum.SEND_HEARTBEAT, AuditLogManager.AUDITLOG_SUCCESS, null);
    return Response.ok().build();
}
Also used : LicenseInfoExt(com.emc.storageos.systemservices.impl.licensing.LicenseInfoExt) LicenseInfoListExt(com.emc.storageos.systemservices.impl.licensing.LicenseInfoListExt) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) ForbiddenException(com.emc.storageos.svcs.errorhandling.resources.ForbiddenException)

Example 2 with LicenseInfoListExt

use of com.emc.storageos.systemservices.impl.licensing.LicenseInfoListExt in project coprhd-controller by CoprHD.

the class CallHomeServiceImpl method internalSendRegistrationEvent.

void internalSendRegistrationEvent() {
    _callHomeEventManager.validateSendEvent();
    LicenseInfoListExt licenseList = null;
    try {
        licenseList = _licenseManager.getLicenseInfoListFromCoordinator();
    } catch (Exception e) {
        throw APIException.internalServerErrors.licenseInfoNotFoundForType("all license types");
    }
    if (licenseList != null) {
        // send registration events for each registered license type
        for (LicenseInfoExt licenseInfo : licenseList.getLicenseList()) {
            if (licenseInfo.isTrialLicense()) {
                _log.warn("Cannot send regisration event to SYR for trial license {}", licenseInfo.getLicenseType().toString());
                throw APIException.forbidden.permissionDeniedForTrialLicense(licenseInfo.getLicenseType().toString());
            }
            _callHomeEventsFacade.sendRegistrationEvent(licenseInfo, getMediaType());
        }
    }
    auditCallhome(OperationTypeEnum.SEND_REGISTRATION, AuditLogManager.AUDITLOG_SUCCESS, null);
}
Also used : LicenseInfoExt(com.emc.storageos.systemservices.impl.licensing.LicenseInfoExt) LicenseInfoListExt(com.emc.storageos.systemservices.impl.licensing.LicenseInfoListExt) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) ForbiddenException(com.emc.storageos.svcs.errorhandling.resources.ForbiddenException)

Aggregations

APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)2 ForbiddenException (com.emc.storageos.svcs.errorhandling.resources.ForbiddenException)2 LicenseInfoExt (com.emc.storageos.systemservices.impl.licensing.LicenseInfoExt)2 LicenseInfoListExt (com.emc.storageos.systemservices.impl.licensing.LicenseInfoListExt)2