use of com.venafi.vcert.sdk.connectors.tpp.endpoint.ssh.TppSshCertRequest in project vcert-java by Venafi.
the class TppConnectorUtils method convertToTppSshCertReq.
public static TppSshCertRequest convertToTppSshCertReq(SshCertificateRequest sshCertificateRequest) throws VCertException {
TppSshCertRequest tppSshCertRequest = new TppSshCertRequest();
tppSshCertRequest.cadn(isNotBlank(sshCertificateRequest.template()) ? getSshCADN(sshCertificateRequest.template()) : null);
tppSshCertRequest.policyDN(isNotBlank(sshCertificateRequest.policyDN()) ? sshCertificateRequest.policyDN() : null);
tppSshCertRequest.objectName(isNotBlank(sshCertificateRequest.objectName()) ? sshCertificateRequest.objectName() : null);
tppSshCertRequest.destinationAddresses(sshCertificateRequest.destinationAddresses() != null && sshCertificateRequest.destinationAddresses().length > 0 ? sshCertificateRequest.destinationAddresses() : null);
tppSshCertRequest.keyId(isNotBlank(sshCertificateRequest.keyId()) ? sshCertificateRequest.keyId() : null);
tppSshCertRequest.principals(sshCertificateRequest.principals() != null && sshCertificateRequest.principals().length > 0 ? sshCertificateRequest.principals() : null);
tppSshCertRequest.validityPeriod(isNotBlank(sshCertificateRequest.validityPeriod()) ? sshCertificateRequest.validityPeriod() : null);
tppSshCertRequest.publicKeyData(isNotBlank(sshCertificateRequest.publicKeyData()) ? sshCertificateRequest.publicKeyData() : null);
tppSshCertRequest.extensions(sshCertificateRequest.extensions() != null && !sshCertificateRequest.extensions().isEmpty() ? sshCertificateRequest.extensions() : null);
tppSshCertRequest.forceCommand(isNotBlank(sshCertificateRequest.forceCommand()) ? sshCertificateRequest.forceCommand() : null);
tppSshCertRequest.sourceAddresses(sshCertificateRequest.sourceAddresses() != null && sshCertificateRequest.sourceAddresses().length > 0 ? sshCertificateRequest.sourceAddresses() : null);
return tppSshCertRequest;
}
use of com.venafi.vcert.sdk.connectors.tpp.endpoint.ssh.TppSshCertRequest in project vcert-java by Venafi.
the class AbstractTppConnector method requestTppSshCertificate.
protected TppSshCertRequestResponse requestTppSshCertificate(SshCertificateRequest sshCertificateRequest) throws VCertException {
TppSshCertRequest tppSshCertRequest = TppConnectorUtils.convertToTppSshCertReq(sshCertificateRequest);
TppSshCertRequestResponse requestResponse;
try {
requestResponse = tppAPI.requestSshCertificate(tppSshCertRequest);
} catch (Exception e) {
throw new VCertException(e);
}
if (!requestResponse.response().success())
throw new RequestCertificateException(requestResponse.response().errorCode(), requestResponse.response().errorMessage());
return requestResponse;
}
Aggregations