PHP示例下的GCP setIamPolicy API参考中的问题 [英] Problem in GCP setIamPolicy API reference under PHP example

查看:126
本文介绍了PHP示例下的GCP setIamPolicy API参考中的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在此页面上 https://cloud.google. com/resource-manager/reference/rest/v1/projects/setIamPolicy

下面是代码示例. PHP代码如下. 问题是线

Way down at the bottom are come code examples. The PHP code follows. The problem is the line

$response = $service->projects->setIamPolicy($resource, $requestBody);

没有定义的项目"属性.我猜这已经过时了.谁能描述应如何使用或提供更正?

There is no defined 'projects' property. I'm guessing this is out of date. Can anyone describe how this should be used, or offer a correction?

require_once __DIR__ . '/vendor/autoload.php';

$client = new Google_Client();
$client->setApplicationName('Google-CloudResourceManagerSample/0.1');
$client->useApplicationDefaultCredentials();
$client->addScope('https://www.googleapis.com/auth/cloud-platform');

$service = new Google_Service_CloudResourceManager($client);

// REQUIRED: The resource for which the policy is being specified.
// See the operation documentation for the appropriate value for this field.
$resource = 'my-resource';  // TODO: Update placeholder value.

// TODO: Assign values to desired properties of `requestBody`:
$requestBody = new Google_Service_CloudResourceManager_SetIamPolicyRequest();

$response = $service->projects->setIamPolicy($resource, $requestBody);

// TODO: Change code below to process the `response` object:
echo '<pre>', var_export($response, true), '</pre>', "\n";

推荐答案

我不认为该示例已经过时,我认为该示例假定您已经审阅了另一份文档:

I don’t think that the example is out-dated, I think that it assumes you have reviewed this other Document:

https://cloud.google.com/resource -manager/reference/rest/v1/projects/get

但是,如果您认为该信息丢失,则可以按文档右上角的发送反馈".

Nevertheless, if you think that the info is missing, you could press "send feedback" on the top-right on the document.

祝你好运!

这篇关于PHP示例下的GCP setIamPolicy API参考中的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆