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 \ StorageMethods
__construct
| Parameters | |
|---|---|
| Name | Description | 
| connection | Connection\ConnectionInterfaceA connection to Cloud Storage. This object is created by StorageClient, and should not be instantiated outside of this client. | 
| projectId | stringThe current project ID. | 
| accessId | stringThe key identifier. | 
| info | array|nullThe key metadata. | 
accessId
Get the HMAC Key Access ID.
Example:
$accessId = $hmacKey->accessId();
| Returns | |
|---|---|
| Type | Description | 
| string | |
reload
Fetch the key metadata from Cloud Storage.
Example:
$keyMetadata = $hmacKey->reload();
| Parameters | |
|---|---|
| Name | Description | 
| options | arrayConfiguration Options | 
| ↳ userProject | stringIf 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 | |
|---|---|
| Type | Description | 
| 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 | |
|---|---|
| Name | Description | 
| options | arrayConfiguration Options | 
| ↳ userProject | stringIf 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 | |
|---|---|
| Type | Description | 
| array | |
update
Update the HMAC Key state.
Example:
$hmacKey->update('INACTIVE');
| Parameters | |
|---|---|
| Name | Description | 
| state | stringThe key state. Either  | 
| options | arrayConfiguration Options | 
| ↳ userProject | stringIf 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 | |
|---|---|
| Type | Description | 
| array | |
delete
Delete the HMAC Key.
Key state must be set to INACTIVE prior to deletion. See
HmacKey::update() for details.
Example:
$hmacKey->delete();
| Parameters | |
|---|---|
| Name | Description | 
| options | arrayConfiguration Options | 
| ↳ userProject | stringIf 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 | |
|---|---|
| Type | Description | 
| void | |