()
| 20 | 'use strict'; |
| 21 | |
| 22 | const authCloudImplicit = async () => { |
| 23 | // [START auth_cloud_implicit] |
| 24 | // Imports the Google Cloud client library. |
| 25 | const {Storage} = require('@google-cloud/storage'); |
| 26 | |
| 27 | // Instantiates a client. If you don't specify credentials when constructing |
| 28 | // the client, the client library will look for credentials in the |
| 29 | // environment. |
| 30 | const storage = new Storage(); |
| 31 | // Makes an authenticated API request. |
| 32 | async function listBuckets() { |
| 33 | try { |
| 34 | const results = await storage.getBuckets(); |
| 35 | |
| 36 | const [buckets] = results; |
| 37 | |
| 38 | console.log('Buckets:'); |
| 39 | buckets.forEach(bucket => { |
| 40 | console.log(bucket.name); |
| 41 | }); |
| 42 | } catch (err) { |
| 43 | console.error('ERROR:', err); |
| 44 | } |
| 45 | } |
| 46 | listBuckets(); |
| 47 | // [END auth_cloud_implicit] |
| 48 | }; |
| 49 | |
| 50 | const authCloudExplicit = async ({projectId, keyFilename}) => { |
| 51 | // [START auth_cloud_explicit] |
nothing calls this directly
no test coverage detected