Search in sources :

Example 1 with PollCertificateSigningResponse

use of com.cloudera.thunderhead.service.publicendpointmanagement.PublicEndpointManagementProto.PollCertificateSigningResponse in project cloudbreak by hortonworks.

the class CreateCertificationPoller method process.

@Override
public AttemptResult<List<String>> process() throws Exception {
    attempt++;
    PollCertificateSigningResponse response = grpcClusterDnsClient.pollCertificateSigning(workflowId, requestId);
    final SigningStatus actualStatus = response.getStatus();
    LOGGER.debug("Polling attempt result: {}", actualStatus);
    if (SigningStatus.SUCCEEDED.equals(actualStatus)) {
        return AttemptResults.finishWith(response.getCertificatesList());
    }
    if (SigningStatus.FAILED.equals(actualStatus)) {
        // return AttemptResults.breakFor(String.format("Certificate creation is failed for %s with message: %s ", workflowId));
        return AttemptResults.breakFor(String.format("Certificate creation is failed for %s.", workflowId));
    }
    LOGGER.info("The certificate polls continued, attempt: {}", attempt);
    return AttemptResults.justContinue();
}
Also used : PollCertificateSigningResponse(com.cloudera.thunderhead.service.publicendpointmanagement.PublicEndpointManagementProto.PollCertificateSigningResponse) SigningStatus(com.cloudera.thunderhead.service.publicendpointmanagement.PublicEndpointManagementProto.PollCertificateSigningResponse.SigningStatus)

Example 2 with PollCertificateSigningResponse

use of com.cloudera.thunderhead.service.publicendpointmanagement.PublicEndpointManagementProto.PollCertificateSigningResponse in project cloudbreak by hortonworks.

the class GrpcClusterDnsClient method pollCertificateSigning.

public PollCertificateSigningResponse pollCertificateSigning(String signingWorkflowId, Optional<String> requestId) {
    try (ManagedChannelWrapper channelWrapper = makeWrapper()) {
        ClusterDnsClient client = makeClient(channelWrapper.getChannel(), regionAwareInternalCrnGeneratorFactory.iam().getInternalCrnForServiceAsString());
        LOGGER.info("Get the result of certification creation with signingWorkflowId: {} and requestId: {}", signingWorkflowId, requestId);
        PollCertificateSigningResponse response = client.pollCertificateSigning(requestId.orElse(UUID.randomUUID().toString()), signingWorkflowId);
        LOGGER.info("The workflow id for polling the result of creation: {}", signingWorkflowId);
        return response;
    }
}
Also used : PollCertificateSigningResponse(com.cloudera.thunderhead.service.publicendpointmanagement.PublicEndpointManagementProto.PollCertificateSigningResponse) ManagedChannelWrapper(com.sequenceiq.cloudbreak.grpc.ManagedChannelWrapper)

Aggregations

PollCertificateSigningResponse (com.cloudera.thunderhead.service.publicendpointmanagement.PublicEndpointManagementProto.PollCertificateSigningResponse)2 SigningStatus (com.cloudera.thunderhead.service.publicendpointmanagement.PublicEndpointManagementProto.PollCertificateSigningResponse.SigningStatus)1 ManagedChannelWrapper (com.sequenceiq.cloudbreak.grpc.ManagedChannelWrapper)1