PHP code example of google / cloud-privilegedaccessmanager

1. Go to this page and download the library: Download google/cloud-privilegedaccessmanager library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

google / cloud-privilegedaccessmanager example snippets


Google\ApiCore\ApiException;
Google\Cloud\PrivilegedAccessManager\V1\Client\PrivilegedAccessManagerClient;
Google\Cloud\PrivilegedAccessManager\V1\Entitlement;
Google\Cloud\PrivilegedAccessManager\V1\GetEntitlementRequest;

// Create a client.
$privilegedAccessManagerClient = new PrivilegedAccessManagerClient();

// Prepare the request message.
$request = (new GetEntitlementRequest())
    ->setName($formattedName);

// Call the API and handle any network failures.
try {
    /** @var Entitlement $response */
    $response = $privilegedAccessManagerClient->getEntitlement($request);
    printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
    printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}