Kms/src/V1/Gapic/KeyManagementServiceGapicClient.php
public function getIamPolicy($resource, array $optionalArgs = [])
    {
        $request = new GetIamPolicyRequest();
        $request->setResource($resource);

        $requestParams = new RequestParamsHeaderDescriptor([
          'resource' => $request->getResource(),
        ]);
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();

        return $this->startCall(
            'GetIamPolicy',
            Policy::class,
            $optionalArgs,
            $request,
            Call::UNARY_CALL,
            'google.iam.v1.IAMPolicy'
        )->wait();
    }
public function getIamPolicy($resource, array $optionalArgs = [])
    {
        $request = new GetIamPolicyRequest();
        $request->setResource($resource);

        $requestParams = new RequestParamsHeaderDescriptor([
          'resource' => $request->getResource(),
        ]);
        $optionalArgs['headers'] = isset($optionalArgs['headers'])
            ? array_merge($requestParams->getHeader(), $optionalArgs['headers'])
            : $requestParams->getHeader();

        return $this->startCall(
            'GetIamPolicy',
            Policy::class,
            $optionalArgs,
            $request,
            Call::UNARY_CALL,
            'google.iam.v1.IAMPolicy'
        )->wait();
    }
public function getIamPolicy ( $ resource , array $ optionalArgs = [ ] ) { $ request = new GetIamPolicyRequest ( ) ; $ request -> setResource ( $ resource ) ; $ requestParams = new RequestParamsHeaderDescriptor ( [ 'resource' => $ request -> getResource ( ) , ] ) ; $ optionalArgs [ 'headers' ] = isset ( $ optionalArgs [ 'headers' ] ) ? array_merge ( $ requestParams -> getHeader ( ) , $ optionalArgs [ 'headers' ] ) : $ requestParams -> getHeader ( ) ; return $ this -> startCall ( 'GetIamPolicy' , Policy :: class , $ optionalArgs , $ request , Call :: UNARY_CALL , 'google.iam.v1.IAMPolicy' ) -> wait ( ) ; }
Gets the access control policy for a resource.
Returns an empty policy if the resource exists and does not have a policy
set.

Sample code:
```
$keyManagementServiceClient = new KeyManagementServiceClient();
try {
$formattedResource = $keyManagementServiceClient->keyRingName('[PROJECT]', '[LOCATION]', '[KEY_RING]');
$response = $keyManagementServiceClient->getIamPolicy($formattedResource);
} finally {
$keyManagementServiceClient->close();
}
```

@param string $resource     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}`.
@param array  $optionalArgs {
Optional.

@type RetrySettings|array $retrySettings
Retry settings to use for this call. Can be a
{@see Google\ApiCore\RetrySettings} object, or an associative array
of retry settings parameters. See the documentation on
{@see Google\ApiCore\RetrySettings} for example usage.
}

@return \Google\Cloud\Iam\V1\Policy

@throws ApiException if the remote call fails
@experimental
Gets the access control policy for a resource . Returns an empty policy if the resource exists and does not have a policy set .