private Storage createClient() throws IOException, GeneralSecurityException { GoogleCredential credential = GoogleCredential.fromStream( new ByteArrayInputStream(settings.serviceAccount.getBytes(StandardCharsets.UTF_8))) .createScoped(Collections.singleton(StorageScopes.CLOUD_PLATFORM)); NetHttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport(); JsonFactory JSON_FACTORY = JacksonFactory.getDefaultInstance(); return new Storage.Builder( httpTransport, JSON_FACTORY, null).setApplicationName(APPLICATION_NAME) .setHttpRequestInitializer(credential).build(); } }
public Storage getStorage() throws IOException { JsonFactory jsonFactory = JacksonFactory.getDefaultInstance(); HttpTransport httpTransport = buildHttpTransport(); GoogleCredential credential = getCredential(httpTransport, jsonFactory, StorageScopes.all()); HttpRequestInitializer reqInit = setHttpTimeout(credential); String applicationName = "Spinnaker/" + applicationVersion; return new Storage.Builder(httpTransport, jsonFactory, credential) .setApplicationName(applicationName) .setHttpRequestInitializer(reqInit) .build(); }
public Storage getStorage() throws IOException { JsonFactory jsonFactory = JacksonFactory.getDefaultInstance(); HttpTransport httpTransport = buildHttpTransport(); GoogleCredential credential = getCredential(httpTransport, jsonFactory, StorageScopes.all()); HttpRequestInitializer reqInit = setHttpTimeout(credential); String applicationName = "Spinnaker/" + applicationVersion; return new Storage.Builder(httpTransport, jsonFactory, credential) .setApplicationName(applicationName) .setHttpRequestInitializer(reqInit) .build(); }