Google Cloud Storage Java Programming Model

From NovaOrdis Knowledge Base
Revision as of 00:15, 3 September 2021 by Ovidiu (talk | contribs) (→‎List Buckets)
Jump to navigation Jump to search

Internal

Overview

ServiceAccountCredentials serviceAccountCredentials;
Storage storageService = StorageOptions.newBuilder().setCredentials(serviceAccountCredentials).build().getService();

Bucket by Name

ServiceAccountCredentials serviceAccountCredentials;
storageService.get(bucketName, options);
// or
storageService.get(bucketName);

List Buckets

Page<Bucket> buckets = storageService.list();

Local Testing

https://github.com/googleapis/google-cloud-java/blob/master/TESTING.md#testing-code-that-uses-storage