Google Cloud Storage Java Programming Model: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 5: Line 5:
ServiceAccountCredentials serviceAccountCredentials;
ServiceAccountCredentials serviceAccountCredentials;
Storage storageService = StorageOptions.newBuilder().setCredentials(serviceAccountCredentials).build().getService();
Storage storageService = StorageOptions.newBuilder().setCredentials(serviceAccountCredentials).build().getService();
</syntaxhighlight>


// bucket by name
=Bucket by Name=
<syntaxhighlight lang='java'>
ServiceAccountCredentials serviceAccountCredentials;
storageService.get(bucketName, options);
storageService.get(bucketName, options);
// list buckets
</syntaxhighlight>
 
=List Buckets=
<syntaxhighlight lang='java'>
Page<Bucket> buckets = storageService.list();
Page<Bucket> buckets = storageService.list();
</syntaxhighlight>
</syntaxhighlight>

Revision as of 18:57, 2 September 2021

Internal

Overview

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

Bucket by Name

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

List Buckets

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