Google\Cloud\PubSub\V1\PublisherClient::getIamPolicy PHP Method

getIamPolicy() public method

Returns an empty policy if the resource exists and does not have a policy set. Sample code: try { $publisherClient = new PublisherClient(); $formattedResource = PublisherClient::formatTopicName("[PROJECT]", "[TOPIC]"); $response = $publisherClient->getIamPolicy($formattedResource); } finally { if (isset($publisherClient)) { $publisherClient->close(); } }
public getIamPolicy ( string $resource, array $optionalArgs = [] ) : google\iam\v1\Policy
$resource string REQUIRED: The resource for which the policy is being requested. `resource` is usually specified as a path. For example, a Project resource is specified as `projects/{project}`.
$optionalArgs array { Optional. @type \Google\GAX\RetrySettings $retrySettings Retry settings to use for this call. If present, then $timeoutMillis is ignored. @type int $timeoutMillis Timeout to use for this call. Only used if $retrySettings is not set. }
return google\iam\v1\Policy
    public function getIamPolicy($resource, $optionalArgs = [])
    {
        $request = new GetIamPolicyRequest();
        $request->setResource($resource);
        $mergedSettings = $this->defaultCallSettings['getIamPolicy']->merge(new CallSettings($optionalArgs));
        $callable = ApiCallable::createApiCall($this->iamPolicyStub, 'GetIamPolicy', $mergedSettings, $this->descriptors['getIamPolicy']);
        return $callable($request, [], ['call_credentials_callback' => $this->createCredentialsCallback()]);
    }