use of com.google.api.services.source.Source in project google-cloud-intellij by GoogleCloudPlatform.
the class CloudRepositoryService method list.
@NotNull
public ListReposResponse list(CredentialedUser user, String cloudProject) throws CloudRepositoryServiceException {
try {
Credential credential = user.getCredential();
HttpRequestInitializer initializer = httpRequest -> {
HttpHeaders headers = new HttpHeaders();
httpRequest.setConnectTimeout(LIST_TIMEOUT_MS);
httpRequest.setReadTimeout(LIST_TIMEOUT_MS);
httpRequest.setHeaders(headers);
credential.initialize(httpRequest);
};
HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();
String userAgent = ServiceManager.getService(PluginInfoService.class).getUserAgent();
Source source = new Source.Builder(httpTransport, JacksonFactory.getDefaultInstance(), initializer).setRootUrl(CLOUD_SOURCE_API_ROOT_URL).setServicePath("").setApplicationName(userAgent).build();
return new CustomUrlSourceRequest(source, cloudProject).execute();
} catch (IOException | GeneralSecurityException ex) {
throw new CloudRepositoryServiceException();
}
}
Aggregations