use of com.google.cloud.http.HttpTransportOptions in project google-cloud-java by GoogleCloudPlatform.
the class RemoteTranslateHelper method create.
/**
* Creates a {@code RemoteTranslateHelper} object for the given API key.
*
* @param apiKey API key used to issue requests to Google Translation.
*/
public static RemoteTranslateHelper create(String apiKey) {
HttpTransportOptions transportOptions = TranslateOptions.getDefaultHttpTransportOptions();
transportOptions = transportOptions.toBuilder().setConnectTimeout(60000).setReadTimeout(60000).build();
TranslateOptions translateOptions = TranslateOptions.newBuilder().setApiKey(apiKey).setRetrySettings(retryParams()).setTransportOptions(transportOptions).build();
return new RemoteTranslateHelper(translateOptions);
}
use of com.google.cloud.http.HttpTransportOptions in project google-cloud-java by GoogleCloudPlatform.
the class RemoteBigQueryHelper method create.
/**
* Creates a {@code RemoteBigQueryHelper} object using default project id and authentication
* credentials.
*/
public static RemoteBigQueryHelper create() {
HttpTransportOptions transportOptions = BigQueryOptions.getDefaultHttpTransportOptions();
transportOptions = transportOptions.toBuilder().setConnectTimeout(60000).setReadTimeout(60000).build();
BigQueryOptions bigqueryOptions = BigQueryOptions.newBuilder().setRetrySettings(retrySettings()).setTransportOptions(transportOptions).build();
return new RemoteBigQueryHelper(bigqueryOptions);
}
use of com.google.cloud.http.HttpTransportOptions in project google-cloud-java by GoogleCloudPlatform.
the class RemoteBigQueryHelper method create.
/**
* Creates a {@code RemoteBigQueryHelper} object for the given project id and JSON key input
* stream.
*
* @param projectId id of the project to be used for running the tests
* @param keyStream input stream for a JSON key
* @return A {@code RemoteBigQueryHelper} object for the provided options
* @throws BigQueryHelperException if {@code keyStream} is not a valid JSON key stream
*/
public static RemoteBigQueryHelper create(String projectId, InputStream keyStream) throws BigQueryHelperException {
try {
HttpTransportOptions transportOptions = BigQueryOptions.getDefaultHttpTransportOptions();
transportOptions = transportOptions.toBuilder().setConnectTimeout(60000).setReadTimeout(60000).build();
BigQueryOptions bigqueryOptions = BigQueryOptions.newBuilder().setCredentials(ServiceAccountCredentials.fromStream(keyStream)).setProjectId(projectId).setRetrySettings(retrySettings()).setTransportOptions(transportOptions).build();
return new RemoteBigQueryHelper(bigqueryOptions);
} catch (IOException ex) {
if (log.isLoggable(Level.WARNING)) {
log.log(Level.WARNING, ex.getMessage());
}
throw BigQueryHelperException.translate(ex);
}
}
use of com.google.cloud.http.HttpTransportOptions in project google-cloud-java by GoogleCloudPlatform.
the class RemoteComputeHelper method create.
/**
* Creates a {@code RemoteComputeHelper} object using default project id and authentication
* credentials.
*/
public static RemoteComputeHelper create() {
HttpTransportOptions transportOptions = ComputeOptions.getDefaultHttpTransportOptions();
transportOptions = transportOptions.toBuilder().setConnectTimeout(60000).setReadTimeout(60000).build();
ComputeOptions computeOptions = ComputeOptions.newBuilder().setRetrySettings(retrySettings()).setTransportOptions(transportOptions).build();
return new RemoteComputeHelper(computeOptions);
}
Aggregations