This class is not meant to be used directly. It should be accessed
through other objects which support IAM.
Note that examples make use of the PubSub API, and the
{@see \Google\Cloud\PubSub\Topic} class.
Policies can be created using the {@see \Google\Cloud\Iam\PolicyBuilder} to
help ensure their validity.
Example:
IAM policies are obtained via resources which implement IAM.
In this example, we'll use PubSub topics to demonstrate
how IAM politices are managed.
use Google\Cloud\ServiceBuilder;
$cloud = new ServiceBuilder;
$pubsub = $cloud->pubsub();
$topic = $pubsub->topic('my-new-topic');
$iam = $topic->iam();
public function testTestPermissions() { $permissions = ['foo', 'bar']; $this->connection->testPermissions(Argument::withEntry('permissions', $permissions))->willReturn($permissions); $iam = new Iam($this->connection->reveal(), self::RESOURCE); $this->assertEquals($permissions, $iam->testPermissions($permissions)); }