Skip to main content

consents

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

Overview

Nameconsents
TypeResource
Idgoogle.healthcare.consents

Fields

NameDatatypeDescription
namestringIdentifier. Resource name of the Consent, of the form projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/consents/{consent_id}. Cannot be changed after creation.
consentArtifactstringRequired. The resource name of the Consent artifact that contains proof of the end user's consent, of the form projects/{project_id}/locations/{location_id}/datasets/{dataset_id}/consentStores/{consent_store_id}/consentArtifacts/{consent_artifact_id}.
expireTimestringTimestamp in UTC of when this Consent is considered expired.
metadataobjectOptional. User-supplied key-value pairs used to organize Consent resources. Metadata keys must: - be between 1 and 63 characters long - have a UTF-8 encoding of maximum 128 bytes - begin with a letter - consist of up to 63 characters including lowercase letters, numeric characters, underscores, and dashes Metadata values must be: - be between 1 and 63 characters long - have a UTF-8 encoding of maximum 128 bytes - consist of up to 63 characters including lowercase letters, numeric characters, underscores, and dashes No more than 64 metadata entries can be associated with a given consent.
policiesarrayOptional. Represents a user's consent in terms of the resources that can be accessed and under what conditions.
revisionCreateTimestringOutput only. The timestamp that the revision was created.
revisionIdstringOutput only. The revision ID of the Consent. The format is an 8-character hexadecimal string. Refer to a specific revision of a Consent by appending @{revision_id} to the Consent's resource name.
statestringRequired. Indicates the current state of this Consent.
ttlstringInput only. The time to live for this Consent from when it is created.
userIdstringRequired. User's UUID provided by the client.

Methods

NameAccessible byRequired ParamsDescription
getSELECTconsentStoresId, consentsId, datasetsId, locationsId, projectsIdGets the specified revision of a Consent, or the latest revision if revision_id is not specified in the resource name.
listSELECTconsentStoresId, datasetsId, locationsId, projectsIdLists the Consent in the given consent store, returning each Consent's latest revision.
createINSERTconsentStoresId, datasetsId, locationsId, projectsIdCreates a new Consent in the parent consent store.
deleteDELETEconsentStoresId, consentsId, datasetsId, locationsId, projectsIdDeletes the Consent and its revisions. To keep a record of the Consent but mark it inactive, see [RevokeConsent]. To delete a revision of a Consent, see [DeleteConsentRevision]. This operation does not delete the related Consent artifact.
patchUPDATEconsentStoresId, consentsId, datasetsId, locationsId, projectsIdUpdates the latest revision of the specified Consent by committing a new revision with the changes. A FAILED_PRECONDITION error occurs if the latest revision of the specified Consent is in the REJECTED or REVOKED state.
activateEXECconsentStoresId, consentsId, datasetsId, locationsId, projectsIdActivates the latest revision of the specified Consent by committing a new revision with state updated to ACTIVE. If the latest revision of the specified Consent is in the ACTIVE state, no new revision is committed. A FAILED_PRECONDITION error occurs if the latest revision of the specified Consent is in the REJECTED or REVOKED state.
rejectEXECconsentStoresId, consentsId, datasetsId, locationsId, projectsIdRejects the latest revision of the specified Consent by committing a new revision with state updated to REJECTED. If the latest revision of the specified Consent is in the REJECTED state, no new revision is committed. A FAILED_PRECONDITION error occurs if the latest revision of the specified Consent is in the ACTIVE or REVOKED state.
revokeEXECconsentStoresId, consentsId, datasetsId, locationsId, projectsIdRevokes the latest revision of the specified Consent by committing a new revision with state updated to REVOKED. If the latest revision of the specified Consent is in the REVOKED state, no new revision is committed. A FAILED_PRECONDITION error occurs if the latest revision of the given consent is in DRAFT or REJECTED state.

SELECT examples

Lists the Consent in the given consent store, returning each Consent's latest revision.

SELECT
name,
consentArtifact,
expireTime,
metadata,
policies,
revisionCreateTime,
revisionId,
state,
ttl,
userId
FROM google.healthcare.consents
WHERE consentStoresId = '{{ consentStoresId }}'
AND datasetsId = '{{ datasetsId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';

INSERT example

Use the following StackQL query and manifest file to create a new consents resource.

/*+ create */
INSERT INTO google.healthcare.consents (
consentStoresId,
datasetsId,
locationsId,
projectsId,
name,
userId,
policies,
consentArtifact,
state,
expireTime,
ttl,
metadata
)
SELECT
'{{ consentStoresId }}',
'{{ datasetsId }}',
'{{ locationsId }}',
'{{ projectsId }}',
'{{ name }}',
'{{ userId }}',
'{{ policies }}',
'{{ consentArtifact }}',
'{{ state }}',
'{{ expireTime }}',
'{{ ttl }}',
'{{ metadata }}'
;

UPDATE example

Updates a consents resource.

/*+ update */
UPDATE google.healthcare.consents
SET
name = '{{ name }}',
userId = '{{ userId }}',
policies = '{{ policies }}',
consentArtifact = '{{ consentArtifact }}',
state = '{{ state }}',
expireTime = '{{ expireTime }}',
ttl = '{{ ttl }}',
metadata = '{{ metadata }}'
WHERE
consentStoresId = '{{ consentStoresId }}'
AND consentsId = '{{ consentsId }}'
AND datasetsId = '{{ datasetsId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';

DELETE example

Deletes the specified consents resource.

/*+ delete */
DELETE FROM google.healthcare.consents
WHERE consentStoresId = '{{ consentStoresId }}'
AND consentsId = '{{ consentsId }}'
AND datasetsId = '{{ datasetsId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';