Skip to main content

key_handles

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

Overview

Namekey_handles
TypeResource
Idgoogle.cloudkms.key_handles

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
namestringIdentifier. Name of the KeyHandle resource, e.g. projects/{PROJECT_ID}/locations/{LOCATION}/keyHandles/{KEY_HANDLE_ID}.
kmsKeystringOutput only. Name of a CryptoKey that has been provisioned for Customer Managed Encryption Key (CMEK) use in the KeyHandle project and location for the requested resource type. The CryptoKey project will reflect the value configured in the AutokeyConfig on the resource project's ancestor folder at the time of the KeyHandle creation. If more than one ancestor folder has a configured AutokeyConfig, the nearest of these configurations is used.
resourceTypeSelectorstringRequired. Indicates the resource type that the resulting CryptoKey is meant to protect, e.g. {SERVICE}.googleapis.com/{TYPE}. See documentation for supported resource types.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectprojectsId, locationsId, keyHandlesIdReturns the KeyHandle.
listselectprojectsId, locationsIdpageSize, pageToken, filterLists KeyHandles.
createinsertprojectsId, locationsIdkeyHandleIdCreates a new KeyHandle, triggering the provisioning of a new CryptoKey for CMEK use with the given resource type in the configured key project and the same location. GetOperation should be used to resolve the resulting long-running operation and get the resulting KeyHandle and CryptoKey.

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
keyHandlesIdstring
locationsIdstring
projectsIdstring
filterstring
keyHandleIdstring
pageSizeinteger (int32)
pageTokenstring

SELECT examples

Returns the KeyHandle.

SELECT
name,
kmsKey,
resourceTypeSelector
FROM google.cloudkms.key_handles
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND keyHandlesId = '{{ keyHandlesId }}' -- required;

INSERT examples

Creates a new KeyHandle, triggering the provisioning of a new CryptoKey for CMEK use with the given resource type in the configured key project and the same location. GetOperation should be used to resolve the resulting long-running operation and get the resulting KeyHandle and CryptoKey.

INSERT INTO google.cloudkms.key_handles (
data__name,
data__resourceTypeSelector,
projectsId,
locationsId,
keyHandleId
)
SELECT
'{{ name }}',
'{{ resourceTypeSelector }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ keyHandleId }}'
RETURNING
name,
done,
error,
metadata,
response
;