MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / addBucketOwner

Function addBucketOwner

storage/addBucketOwnerAcl.js:42–59  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

40 const storage = new Storage();
41
42 async function addBucketOwner() {
43 try {
44 // Makes the user an owner of the bucket. You can use addAllUsers(),
45 // addDomain(), addProject(), addGroup(), and addAllAuthenticatedUsers()
46 // to grant access to different types of entities. You can also use "readers"
47 // and "writers" to grant different roles.
48 await storage.bucket(bucketName).acl.owners.addUser(userEmail);
49
50 console.log(
51 `Added user ${userEmail} as an owner on bucket ${bucketName}.`
52 );
53 } catch (error) {
54 console.error(
55 'Error executing add bucket owner ACL:',
56 error.message || error
57 );
58 }
59 }
60
61 addBucketOwner();
62 // [END storage_add_bucket_owner]

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected