Class Iam (5.17.0)

Get and set IAM policies for your Cloud Storage bucket.

See Cloud Storage IAM Management See Granting, Changing, and Revoking Access See IAM Roles

Iam

Package

@google-cloud/storage

Example


const {Storage} = require('@google-cloud/storage');
const storage = new Storage();
const bucket = storage.bucket('my-bucket');
// bucket.iam

Constructors

(constructor)(bucket)

constructor(bucket: Bucket);

Constructs a new instance of the Iam class

Parameter
NameDescription
bucket Bucket

Methods

getPolicy(options)

getPolicy(options?: GetPolicyOptions): Promise<GetPolicyResponse>;
Parameter
NameDescription
options GetPolicyOptions
Returns
TypeDescription
Promise<GetPolicyResponse>

getPolicy(options, callback)

getPolicy(options: GetPolicyOptions, callback: GetPolicyCallback): void;
Parameters
NameDescription
options GetPolicyOptions
callback GetPolicyCallback
Returns
TypeDescription
void

getPolicy(callback)

getPolicy(callback: GetPolicyCallback): void;
Parameter
NameDescription
callback GetPolicyCallback
Returns
TypeDescription
void

setPolicy(policy, options)

setPolicy(policy: Policy, options?: SetPolicyOptions): Promise<SetPolicyResponse>;
Parameters
NameDescription
policy Policy
options SetPolicyOptions
Returns
TypeDescription
Promise<SetPolicyResponse>

setPolicy(policy, callback)

setPolicy(policy: Policy, callback: SetPolicyCallback): void;
Parameters
NameDescription
policy Policy
callback SetPolicyCallback
Returns
TypeDescription
void

setPolicy(policy, options, callback)

setPolicy(policy: Policy, options: SetPolicyOptions, callback: SetPolicyCallback): void;
Parameters
NameDescription
policy Policy
options SetPolicyOptions
callback SetPolicyCallback
Returns
TypeDescription
void

testPermissions(permissions, options)

testPermissions(permissions: string | string[], options?: TestIamPermissionsOptions): Promise<TestIamPermissionsResponse>;
Parameters
NameDescription
permissions string | string[]
options TestIamPermissionsOptions
Returns
TypeDescription
Promise<TestIamPermissionsResponse>

testPermissions(permissions, callback)

testPermissions(permissions: string | string[], callback: TestIamPermissionsCallback): void;
Parameters
NameDescription
permissions string | string[]
callback TestIamPermissionsCallback
Returns
TypeDescription
void

testPermissions(permissions, options, callback)

testPermissions(permissions: string | string[], options: TestIamPermissionsOptions, callback: TestIamPermissionsCallback): void;
Parameters
NameDescription
permissions string | string[]
options TestIamPermissionsOptions
callback TestIamPermissionsCallback
Returns
TypeDescription
void