use of com.cloudera.thunderhead.service.minasshdmanagement.MinaSshdManagementProto.AcquireMinaSshdServiceResponse in project cloudbreak by hortonworks.
the class MinaSshdManagementClient method acquireMinaSshdService.
/**
* Wraps call to acquireMinaSshdService.
*
* @param requestId the request ID for the request
* @param accountId the account ID
* @return the minasshd service
* @throws CcmException if an exception occurs
*/
public MinaSshdService acquireMinaSshdService(String requestId, String accountId) throws CcmException {
checkNotNull(requestId, "requestId should not be null.");
checkNotNull(accountId, "accountId should not be null.");
MinaSshdManagementBlockingStub blockingStub = newStub(requestId);
AcquireMinaSshdServiceRequest.Builder requestBuilder = AcquireMinaSshdServiceRequest.newBuilder().setAccountId(accountId);
try {
LOGGER.debug("Calling acquireMinaSshdService with requestId: {}, accountId: {}", requestId, accountId);
AcquireMinaSshdServiceResponse response = blockingStub.acquireMinaSshdService(requestBuilder.build());
if (response == null) {
throw new CcmException("Got null response from MinaSshdManagementService acquireMinaSshdService gRPC call", false);
} else {
MinaSshdService minaSshdService = response.getMinaSshdService();
if (minaSshdService == null) {
throw new CcmException("Got null minasshd service in MinaSshdManagementService acquireMinaSshdService gRPC response", false);
} else {
return minaSshdService;
}
}
} catch (StatusRuntimeException e) {
String message = "MinaSshdManagementService acquireMinaSshdService gRPC call failed: " + e.getMessage();
Status status = e.getStatus();
Status.Code code = status.getCode();
boolean retryable = GrpcUtil.isRetryable(code);
LOGGER.debug("Got status code: {}, retryable: {}", code, retryable);
throw new CcmException(message, e, retryable);
}
}
Aggregations