Skip to main content

hmac_keys

Creates, updates, deletes, gets or lists a hmac_keys resource.

Overview

Namehmac_keys
TypeResource
Idgoogle.storage.hmac_keys

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
idstringThe ID of the HMAC key, including the Project ID and the Access ID.
accessIdstringThe ID of the HMAC Key.
etagstringHTTP 1.1 Entity tag for the HMAC key.
kindstringThe kind of item this is. For HMAC Key metadata, this is always storage#hmacKeyMetadata. (default: storage#hmacKeyMetadata)
projectIdstringProject ID owning the service account to which the key authenticates.
selfLinkstringThe link to this resource.
serviceAccountEmailstringThe email address of the key's associated service account.
statestringThe state of the key. Can be one of ACTIVE, INACTIVE, or DELETED.
timeCreatedstring (date-time)The creation time of the HMAC key in RFC 3339 format.
updatedstring (date-time)The last modification time of the HMAC key metadata in RFC 3339 format.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectprojectId, accessIduserProjectRetrieves an HMAC key's metadata
listselectprojectIdmaxResults, pageToken, serviceAccountEmail, showDeletedKeys, userProjectRetrieves a list of HMAC keys matching the criteria.
createinsertprojectId, serviceAccountEmailuserProjectCreates a new HMAC key for the specified service account.
updatereplaceprojectId, accessIduserProjectUpdates the state of an HMAC key. See the HMAC Key resource descriptor for valid states.
deletedeleteprojectId, accessIduserProjectDeletes an HMAC key.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
accessIdstring
projectIdstring
serviceAccountEmailstring
maxResultsinteger (uint32)
pageTokenstring
serviceAccountEmailstring
showDeletedKeysboolean
userProjectstring

SELECT examples

Retrieves an HMAC key's metadata

SELECT
id,
accessId,
etag,
kind,
projectId,
selfLink,
serviceAccountEmail,
state,
timeCreated,
updated
FROM google.storage.hmac_keys
WHERE projectId = '{{ projectId }}' -- required
AND accessId = '{{ accessId }}' -- required
AND userProject = '{{ userProject }}';

INSERT examples

Creates a new HMAC key for the specified service account.

INSERT INTO google.storage.hmac_keys (
projectId,
serviceAccountEmail,
userProject
)
SELECT
'{{ projectId }}',
'{{ serviceAccountEmail }}',
'{{ userProject }}'
RETURNING
kind,
metadata,
secret
;

REPLACE examples

Updates the state of an HMAC key. See the HMAC Key resource descriptor for valid states.

REPLACE google.storage.hmac_keys
SET
data__accessId = '{{ accessId }}',
data__etag = '{{ etag }}',
data__id = '{{ id }}',
data__kind = '{{ kind }}',
data__projectId = '{{ projectId }}',
data__selfLink = '{{ selfLink }}',
data__serviceAccountEmail = '{{ serviceAccountEmail }}',
data__state = '{{ state }}',
data__timeCreated = '{{ timeCreated }}',
data__updated = '{{ updated }}'
WHERE
projectId = '{{ projectId }}' --required
AND accessId = '{{ accessId }}' --required
AND userProject = '{{ userProject}}'
RETURNING
id,
accessId,
etag,
kind,
projectId,
selfLink,
serviceAccountEmail,
state,
timeCreated,
updated;

DELETE examples

Deletes an HMAC key.

DELETE FROM google.storage.hmac_keys
WHERE projectId = '{{ projectId }}' --required
AND accessId = '{{ accessId }}' --required
AND userProject = '{{ userProject }}';