| 40 | const storage = new Storage(); |
| 41 | |
| 42 | async function getMetadata() { |
| 43 | try { |
| 44 | // Get the notification metadata |
| 45 | const [metadata] = await storage |
| 46 | .bucket(bucketName) |
| 47 | .notification(notificationId) |
| 48 | .getMetadata(); |
| 49 | |
| 50 | console.log(`ID: ${metadata.id}`); |
| 51 | console.log(`Topic: ${metadata.topic}`); |
| 52 | console.log(`Event Types: ${metadata.event_types}`); |
| 53 | console.log(`Custom Attributes: ${metadata.custom_attributes}`); |
| 54 | console.log(`Payload Format: ${metadata.payload_format}`); |
| 55 | console.log(`Object Name Prefix: ${metadata.object_name_prefix}`); |
| 56 | console.log(`Etag: ${metadata.etag}`); |
| 57 | console.log(`Self Link: ${metadata.selfLink}`); |
| 58 | console.log(`Kind: ${metadata.kind}`); |
| 59 | } catch (error) { |
| 60 | console.error('Error executing get metadata:', error.message || error); |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | getMetadata(); |
| 65 | // [END storage_print_pubsub_bucket_notification] |