Google Cloud Storage Java Programming Model: Difference between revisions
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= | |||
<syntaxhighlight lang='java'> | |||
ServiceAccountCredentials serviceAccountCredentials; | |||
storageService.get(bucketName, options); | storageService.get(bucketName, options); | ||
/ | </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();