Cloud Storage Client - Class HmacKey (1.34.0)

Reference documentation and code samples for the Cloud Storage Client class HmacKey.

Represents a Service Account HMAC key.

Example:

use Google\Cloud\Storage\StorageClient;

$storage = new StorageClient();
$hmacKey = $storage->hmacKey($accessId);

Namespace

Google \ Cloud \ Storage

Methods

__construct

Parameters
NameDescription
connection Google\Cloud\Storage\Connection\ConnectionInterface

A connection to Cloud Storage. This object is created by StorageClient, and should not be instantiated outside of this client.

projectId string

The current project ID.

accessId string

The key identifier.

info array|null

The key metadata.

accessId

Get the HMAC Key Access ID.

Example:

$accessId = $hmacKey->accessId();
Returns
TypeDescription
string

reload

Fetch the key metadata from Cloud Storage.

Example:

$keyMetadata = $hmacKey->reload();
Parameters
NameDescription
options array

Configuration Options

↳ userProject string

If set, this is the ID of the project which will be billed for the request. NOTE: This option is currently ignored by Cloud Storage.

Returns
TypeDescription
array

info

Get the HMAC Key Metadata.

If the metadata is not already available, it will be requested from Cloud Storage.

Example:

$keyMetadata = $hmacKey->info();
Parameters
NameDescription
options array

Configuration Options

↳ userProject string

If set, this is the ID of the project which will be billed for the request. NOTE: This option is currently ignored by Cloud Storage.

Returns
TypeDescription
array

update

Update the HMAC Key state.

Example:

$hmacKey->update('INACTIVE');
Parameters
NameDescription
state string

The key state. Either ACTIVE or INACTIVE.

options array

Configuration Options

↳ userProject string

If set, this is the ID of the project which will be billed for the request. NOTE: This option is currently ignored by Cloud Storage.

Returns
TypeDescription
array

delete

Delete the HMAC Key.

Key state must be set to INACTIVE prior to deletion. See Google\Cloud\Storage\HmacKey::update() for details.

Example:

$hmacKey->delete();
Parameters
NameDescription
options array

Configuration Options

↳ userProject string

If set, this is the ID of the project which will be billed for the request. NOTE: This option is currently ignored by Cloud Storage.

Returns
TypeDescription
void