Skip to main content

consents

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

Overview

Nameconsents
TypeResource
Idgoogle.healthcare.consents

Fields

The following fields are returned by SELECT queries:

Successful response

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}.
expireTimestring (google-datetime)Timestamp 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.
revisionCreateTimestring (google-datetime)Output 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.
ttlstring (google-duration)Input only. The time to live for this Consent from when it is created.
userIdstringRequired. User's UUID provided by the client.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectprojectsId, locationsId, datasetsId, consentStoresId, consentsIdGets the specified revision of a Consent, or the latest revision if revision_id is not specified in the resource name.
listselectprojectsId, locationsId, datasetsId, consentStoresIdpageSize, pageToken, filterLists the Consent in the given consent store, returning each Consent's latest revision.
createinsertprojectsId, locationsId, datasetsId, consentStoresIdCreates a new Consent in the parent consent store.
patchupdateprojectsId, locationsId, datasetsId, consentStoresId, consentsIdupdateMaskUpdates 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.
deletedeleteprojectsId, locationsId, datasetsId, consentStoresId, consentsIdDeletes 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.
activateexecprojectsId, locationsId, datasetsId, consentStoresId, consentsIdActivates 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.
rejectexecprojectsId, locationsId, datasetsId, consentStoresId, consentsIdRejects 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.
revokeexecprojectsId, locationsId, datasetsId, consentStoresId, consentsIdRevokes 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.

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
consentStoresIdstring
consentsIdstring
datasetsIdstring
locationsIdstring
projectsIdstring
filterstring
pageSizeinteger (int32)
pageTokenstring
updateMaskstring (google-fieldmask)

SELECT examples

Gets the specified revision of a Consent, or the latest revision if revision_id is not specified in the resource name.

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

INSERT examples

Creates a new Consent in the parent consent store.

INSERT INTO google.healthcare.consents (
data__name,
data__userId,
data__policies,
data__consentArtifact,
data__state,
data__expireTime,
data__ttl,
data__metadata,
projectsId,
locationsId,
datasetsId,
consentStoresId
)
SELECT
'{{ name }}',
'{{ userId }}',
'{{ policies }}',
'{{ consentArtifact }}',
'{{ state }}',
'{{ expireTime }}',
'{{ ttl }}',
'{{ metadata }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ datasetsId }}',
'{{ consentStoresId }}'
RETURNING
name,
consentArtifact,
expireTime,
metadata,
policies,
revisionCreateTime,
revisionId,
state,
ttl,
userId
;

UPDATE examples

Updates 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.

UPDATE google.healthcare.consents
SET
data__name = '{{ name }}',
data__userId = '{{ userId }}',
data__policies = '{{ policies }}',
data__consentArtifact = '{{ consentArtifact }}',
data__state = '{{ state }}',
data__expireTime = '{{ expireTime }}',
data__ttl = '{{ ttl }}',
data__metadata = '{{ metadata }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND datasetsId = '{{ datasetsId }}' --required
AND consentStoresId = '{{ consentStoresId }}' --required
AND consentsId = '{{ consentsId }}' --required
AND updateMask = '{{ updateMask}}'
RETURNING
name,
consentArtifact,
expireTime,
metadata,
policies,
revisionCreateTime,
revisionId,
state,
ttl,
userId;

DELETE examples

Deletes 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.

DELETE FROM google.healthcare.consents
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND datasetsId = '{{ datasetsId }}' --required
AND consentStoresId = '{{ consentStoresId }}' --required
AND consentsId = '{{ consentsId }}' --required;

Lifecycle Methods

Activates 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.

EXEC google.healthcare.consents.activate 
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@datasetsId='{{ datasetsId }}' --required,
@consentStoresId='{{ consentStoresId }}' --required,
@consentsId='{{ consentsId }}' --required
@@json=
'{
"consentArtifact": "{{ consentArtifact }}",
"expireTime": "{{ expireTime }}",
"ttl": "{{ ttl }}"
}';