Skip to main content

resource_secrets

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

Overview​

Nameresource_secrets
TypeResource
Idovh.okms.resource_secrets

Fields​

The following fields are returned by SELECT queries:

successful operation

NameDatatypeDescription
iamobjectIAM resource metadata
metadataobjectSecret metadata
pathstringUnique identifier of the secret
versionobjectData of the secret version

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectokms_id, pathinclude_data, versionReturns a secret's metadata. By default the latest version is selected. Pass version to target another one.<br /><br />Set includeData=true to also return that version's data (requires the matching IAM action).
listselectokms_idx_pagination_cursor, x_pagination_size, iam_tagsLists secret paths with metadata (versions, CAS settings). The content of secret versions is not accessible through this API.
createinsertokms_id, path, versionCreates a secret at the given path and stores the first version.<br />Path and engine defaults (CAS, max versions) apply from the service secret config unless overridden in the body.
updateupdateokms_id, pathcasUpdates the secret: include version.data to add a new version, and/or metadata to change this secret's engine settings.<br />When cas is set, it must equal the current version for the write to succeed.
deletedeleteokms_id, pathDeletes the secret and all its versions.

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
api_hoststringThe OVHcloud API host. Selected by OVH_ENDPOINT (ovh-eu, ovh-ca or ovh-us; default ovh-eu). (default: api.eu.ovhcloud.com, x-stackQL-envVarSelector: {"envVar":"OVH_ENDPOINT","default":"ovh-eu","values":{"ovh-eu":"api.eu.ovhcloud.com","ovh-ca":"api.ca.ovhcloud.com","ovh-us":"api.us.ovhcloud.com"}})
okms_idstring (uuid)Okms ID (wire: okmsId)
pathstringPath
casintegerCurrent secret version number. When the cas (Check and set) is specified, the current version of the secret is verified before updating it. In order for a write to be successful,cas must be set to the current version of the secret.
iam_tagsobjectFilter resources on IAM tags (wire: iamTags)
include_databooleanSecret data (wire: includeData)
versionintegerSecret version. When omitted, the latest version will be returned.
x_pagination_cursorstringPagination cursor (wire: X-Pagination-Cursor)
x_pagination_sizeintegerPagination size (wire: X-Pagination-Size)

SELECT examples​

Returns a secret's metadata. By default the latest version is selected. Pass version to target another one.<br /><br />Set includeData=true to also return that version's data (requires the matching IAM action).

SELECT
iam,
metadata,
path,
version
FROM ovh.okms.resource_secrets
WHERE okms_id = '{{ okms_id }}' -- required
AND path = '{{ path }}' -- required
AND include_data = '{{ include_data }}'
AND version = '{{ version }}'
;

INSERT examples​

Creates a secret at the given path and stores the first version.<br />Path and engine defaults (CAS, max versions) apply from the service secret config unless overridden in the body.

INSERT INTO ovh.okms.resource_secrets (
metadata,
path,
version,
okms_id
)
SELECT
'{{ metadata }}',
'{{ path }}' /* required */,
'{{ version }}' /* required */,
'{{ okms_id }}'
RETURNING
metadata,
path
;

UPDATE examples​

Updates the secret: include version.data to add a new version, and/or metadata to change this secret's engine settings.<br />When cas is set, it must equal the current version for the write to succeed.

UPDATE ovh.okms.resource_secrets
SET
metadata = '{{ metadata }}',
version = '{{ version }}'
WHERE
okms_id = '{{ okms_id }}' --required
AND path = '{{ path }}' --required
AND cas = '{{ cas}}'
RETURNING
metadata,
path;

DELETE examples​

Deletes the secret and all its versions.

DELETE FROM ovh.okms.resource_secrets
WHERE okms_id = '{{ okms_id }}' --required
AND path = '{{ path }}' --required
;