Search in sources :

Example 1 with UnregisterSshTunnelingKeyResponse

use of com.cloudera.thunderhead.service.minasshdmanagement.MinaSshdManagementProto.UnregisterSshTunnelingKeyResponse in project cloudbreak by hortonworks.

the class MinaSshdManagementClient method unregisterSshTunnelingKey.

/**
 * Wraps call to unregisterSshTunnelingKey.
 *
 * @param requestId         the request ID for the request
 * @param minaSshdServiceId the minasshd service ID
 * @param keyId             the key ID
 * @return the response
 * @throws CcmException if an exception occurs
 */
public UnregisterSshTunnelingKeyResponse unregisterSshTunnelingKey(String requestId, String minaSshdServiceId, String keyId) throws CcmException {
    checkNotNull(requestId, "requestId should not be null.");
    checkNotNull(minaSshdServiceId);
    checkNotNull(keyId);
    MinaSshdManagementBlockingStub blockingStub = newStub(requestId);
    UnregisterSshTunnelingKeyRequest.Builder requestBuilder = UnregisterSshTunnelingKeyRequest.newBuilder().setMinaSshdServiceId(minaSshdServiceId).setKeyId(keyId);
    try {
        LOGGER.debug("Calling unregisterSshTunnelingKey with requestId: {}, minaSshdServiceId: {}, keyId: {}", requestId, minaSshdServiceId, keyId);
        UnregisterSshTunnelingKeyResponse response = blockingStub.unregisterSshTunnelingKey(requestBuilder.build());
        if (response == null) {
            throw new CcmException("Got null response from MinaSshdManagementService unregisterSshTunnelingKey gRPC call", false);
        } else {
            return response;
        }
    } catch (StatusRuntimeException e) {
        String message = "MinaSshdManagementService unregisterSshTunnelingKey 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);
    }
}
Also used : Status(io.grpc.Status) CcmException(com.sequenceiq.cloudbreak.ccm.exception.CcmException) StatusRuntimeException(io.grpc.StatusRuntimeException) MinaSshdManagementBlockingStub(com.cloudera.thunderhead.service.minasshdmanagement.MinaSshdManagementGrpc.MinaSshdManagementBlockingStub) UnregisterSshTunnelingKeyRequest(com.cloudera.thunderhead.service.minasshdmanagement.MinaSshdManagementProto.UnregisterSshTunnelingKeyRequest) UnregisterSshTunnelingKeyResponse(com.cloudera.thunderhead.service.minasshdmanagement.MinaSshdManagementProto.UnregisterSshTunnelingKeyResponse)

Aggregations

MinaSshdManagementBlockingStub (com.cloudera.thunderhead.service.minasshdmanagement.MinaSshdManagementGrpc.MinaSshdManagementBlockingStub)1 UnregisterSshTunnelingKeyRequest (com.cloudera.thunderhead.service.minasshdmanagement.MinaSshdManagementProto.UnregisterSshTunnelingKeyRequest)1 UnregisterSshTunnelingKeyResponse (com.cloudera.thunderhead.service.minasshdmanagement.MinaSshdManagementProto.UnregisterSshTunnelingKeyResponse)1 CcmException (com.sequenceiq.cloudbreak.ccm.exception.CcmException)1 Status (io.grpc.Status)1 StatusRuntimeException (io.grpc.StatusRuntimeException)1