MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / main

Function main

healthcare/consent/patchConsentStore.js:17–58  ·  view source on GitHub ↗
(
  projectId = process.env.GOOGLE_CLOUD_PROJECT,
  cloudRegion = 'us-central1',
  datasetId,
  consentStoreId,
  defaultConsentTtl
)

Source from the content-addressed store, hash-verified

15'use strict';
16
17const main = (
18 projectId = process.env.GOOGLE_CLOUD_PROJECT,
19 cloudRegion = 'us-central1',
20 datasetId,
21 consentStoreId,
22 defaultConsentTtl
23) => {
24 // [START healthcare_patch_consent_store]
25 const google = require('@googleapis/healthcare');
26 const healthcare = google.healthcare({
27 version: 'v1',
28 auth: new google.auth.GoogleAuth({
29 scopes: ['https://www.googleapis.com/auth/cloud-platform'],
30 }),
31 });
32
33 const patchConsentStore = async () => {
34 // TODO(developer): uncomment these lines before running the sample
35 // const cloudRegion = 'us-central1';
36 // const projectId = 'adjective-noun-123';
37 // const datasetId = 'my-dataset';
38 // const consentStoreId = 'my-consent-store';
39 // const defaultConsentTtl = '172800s' Must be at least 24 hours, specified
40 // in seconds, appended with 's' character.
41 const name = `projects/${projectId}/locations/${cloudRegion}/datasets/${datasetId}/consentStores/${consentStoreId}`;
42 const request = {
43 name,
44 updateMask: 'defaultConsentTtl',
45 resource: {
46 defaultConsentTtl: defaultConsentTtl,
47 },
48 };
49
50 await healthcare.projects.locations.datasets.consentStores.patch(request);
51 console.log(
52 `Patched consent store ${consentStoreId} with default consent time-to-live ${defaultConsentTtl}`
53 );
54 };
55
56 patchConsentStore();
57 // [END healthcare_patch_consent_store]
58};
59
60// node patchConsentStore.js <projectId> <cloudRegion> <datasetId> <consentStoreId> <defaultConsentTtl>
61main(...process.argv.slice(2));

Callers 1

Calls 1

patchConsentStoreFunction · 0.85

Tested by

no test coverage detected