Skip to content

Commit dd647e5

Browse files
feat: add batchGetEffectiveIamPolicies sample code. (#654)
* feat: add batchGetEffectiveIamPolicies sample code. Add batchGetEffectiveIamPolicies sample code and also lint the protobuf imports. * chore: fix the Copyright year for getBatchEffectiveIamPolicies.js * chore: refactor logging and remove loop for checking results * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: modify the logging to print nested Object. Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 1932c19 commit dd647e5

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

packages/google-cloud-asset/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ Samples are in the [`samples/`](https://github.com/googleapis/nodejs-asset/tree/
102102
| Export Assets | [source code](https://github.com/googleapis/nodejs-asset/blob/main/samples/exportAssets.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-asset&page=editor&open_in_editor=samples/exportAssets.js,samples/README.md) |
103103
| Export Assets To BigQuery | [source code](https://github.com/googleapis/nodejs-asset/blob/main/samples/exportAssetsBigquery.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-asset&page=editor&open_in_editor=samples/exportAssetsBigquery.js,samples/README.md) |
104104
| Get Batch Asset History | [source code](https://github.com/googleapis/nodejs-asset/blob/main/samples/getBatchAssetHistory.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-asset&page=editor&open_in_editor=samples/getBatchAssetHistory.js,samples/README.md) |
105+
| Batch Get Effective Iam Policies | [source code](https://github.com/googleapis/nodejs-asset/blob/main/samples/getBatchEffectiveIamPolicies.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-asset&page=editor&open_in_editor=samples/getBatchEffectiveIamPolicies.js,samples/README.md) |
105106
| Get Feed | [source code](https://github.com/googleapis/nodejs-asset/blob/main/samples/getFeed.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-asset&page=editor&open_in_editor=samples/getFeed.js,samples/README.md) |
106107
| List Assets | [source code](https://github.com/googleapis/nodejs-asset/blob/main/samples/listAssets.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-asset&page=editor&open_in_editor=samples/listAssets.js,samples/README.md) |
107108
| List Feeds | [source code](https://github.com/googleapis/nodejs-asset/blob/main/samples/listFeeds.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-asset&page=editor&open_in_editor=samples/listFeeds.js,samples/README.md) |

packages/google-cloud-asset/samples/README.md

+20
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
* [Export Assets](#export-assets)
2121
* [Export Assets To BigQuery](#export-assets-to-bigquery)
2222
* [Get Batch Asset History](#get-batch-asset-history)
23+
* [Batch Get Effective Iam Policies](#batch-get-effective-iam-policies)
2324
* [Get Feed](#get-feed)
2425
* [List Assets](#list-assets)
2526
* [List Feeds](#list-feeds)
@@ -195,6 +196,25 @@ __Usage:__
195196

196197

197198

199+
### Batch Get Effective Iam Policies
200+
201+
Batch get effective IAM policies that match a request.
202+
203+
View the [source code](https://github.com/googleapis/nodejs-asset/blob/main/samples/getBatchEffectiveIamPolicies.js).
204+
205+
[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-asset&page=editor&open_in_editor=samples/getBatchEffectiveIamPolicies.js,samples/README.md)
206+
207+
__Usage:__
208+
209+
210+
`node batchGetEffectiveIamPolicies`
211+
212+
213+
-----
214+
215+
216+
217+
198218
### Get Feed
199219

200220
Get Feed.

packages/google-cloud-asset/samples/test/sample.test.js

+6
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,12 @@ describe('quickstart sample tests', () => {
186186
assert.include(stdout, 'relatedAsset');
187187
});
188188

189+
it('should get effective iam policies successfully', async () => {
190+
const assetName = `//storage.googleapis.com/${bucketName}`;
191+
const stdout = execSync(`node getBatchEffectiveIamPolicies ${assetName}`);
192+
assert.include(stdout, assetName);
193+
});
194+
189195
it('should analyze iam policy successfully', async () => {
190196
const stdout = execSync('node analyzeIamPolicy');
191197
assert.include(stdout, '//cloudresourcemanager.googleapis.com/projects');

0 commit comments

Comments
 (0)