use of com.blackducksoftware.integration.hub.rest.RestConnection in project hub-docker-inspector by blackducksoftware.
the class HubClient method phoneHomeHubConnection.
private void phoneHomeHubConnection(final String dockerEngineVersion) throws IOException, EncryptionException {
final RestConnection restConnection = createRestConnection();
final HubServicesFactory hubServicesFactory = new HubServicesFactory(restConnection);
final PhoneHomeService phoner = hubServicesFactory.createPhoneHomeService();
final PhoneHomeRequestBodyBuilder phoneHomeRequestBodyBuilder = phoner.createInitialPhoneHomeRequestBodyBuilder(THIRD_PARTY_NAME_DOCKER, dockerEngineVersion, programVersion.getProgramVersion());
phoneHomeRequestBodyBuilder.setBlackDuckName(BlackDuckName.HUB);
if (!StringUtils.isBlank(config.getCallerName())) {
phoneHomeRequestBodyBuilder.addToMetaDataMap(PHONE_HOME_METADATA_NAME_CALLER_NAME, config.getCallerName());
}
if (!StringUtils.isBlank(config.getCallerVersion())) {
phoneHomeRequestBodyBuilder.addToMetaDataMap(PHONE_HOME_METADATA_NAME_CALLER_VERSION, config.getCallerVersion());
}
final PhoneHomeRequestBody phoneHomeRequestBody = phoneHomeRequestBodyBuilder.buildObject();
phoner.phoneHome(phoneHomeRequestBody);
logger.trace("Attempt to phone home completed");
}
use of com.blackducksoftware.integration.hub.rest.RestConnection in project hub-docker-inspector by blackducksoftware.
the class HubClient method testHubConnection.
public void testHubConnection() throws HubIntegrationException {
// ArgsWithSpacesTest tests this in output
logger.trace(String.format("Hub username: %s", getHubUsername()));
if (!config.isUploadBdio()) {
logger.debug("Upload of BDIO not enabled; skipping verification of Hub connection");
return;
}
RestConnection restConnection;
try {
restConnection = createRestConnection();
restConnection.connect();
} catch (final IntegrationException e) {
final String msg = String.format("Error connecting to Hub: %s", e.getMessage());
throw new HubIntegrationException(msg);
}
logger.info("Successful connection to the Hub.");
}
use of com.blackducksoftware.integration.hub.rest.RestConnection in project hub-docker-inspector by blackducksoftware.
the class ImageInspectorClient method createConnection.
private RestConnection createConnection(final String baseUrl, final int timeoutSeconds) throws MalformedURLException {
final UnauthenticatedRestConnectionBuilder connectionBuilder = new UnauthenticatedRestConnectionBuilder();
connectionBuilder.setBaseUrl(baseUrl);
connectionBuilder.setTimeout(timeoutSeconds);
final IntLogger intLogger = new Slf4jIntLogger(logger);
connectionBuilder.setLogger(intLogger);
connectionBuilder.setAlwaysTrustServerCertificate(false);
final RestConnection connection = connectionBuilder.build();
return connection;
}
Aggregations