File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change 2121use Google \Cloud \Asset \V1 \AssetServiceClient ;
2222
2323/**
24- * @param string $projectId the project Id for list assets.
24+ * @param string $projectId Tthe project Id for list assets.
25+ * @param string|array $assetTypes (Optional) Asset types to list for.
26+ * @param int $pageSize (Optional) Size of one result page.
2527 */
26- function list_assets (string $ projectId )
28+ function list_assets (string $ projectId, array $ assetTypes = [], int $ pageSize )
2729{
2830 // Instantiate a client.
2931 $ client = new AssetServiceClient ();
3032
3133 // Run request
32- $ response = $ client ->listAssets ("projects/ $ projectId " );
34+ $ response = $ client ->listAssets (
35+ "projects/ $ projectId " , [
36+ 'assetTypes ' => $ assetTypes ,
37+ 'pageSize ' => $ pageSize ,
38+ ]);
3339
3440 // Print the asset names in the result
3541 foreach ($ response ->getPage () as $ asset ) {
Original file line number Diff line number Diff line change @@ -64,7 +64,9 @@ public function testListAssets()
6464 $ assetName = '//storage.googleapis.com/ ' . self ::$ bucketName ;
6565 $ this ->runEventuallyConsistentTest (function () use ($ assetName ) {
6666 $ output = $ this ->runFunctionSnippet ('list_assets ' , [
67- 'projectId ' => self ::$ projectId ,
67+ 'projectId ' => self ::$ projectId ,
68+ 'assetTypes ' => ['storage.buckets ' ],
69+ 'pageSize ' => 1000 ,
6870 ]);
6971
7072 $ this ->assertStringContainsString ($ assetName , $ output );
You can’t perform that action at this time.
0 commit comments