const healthcare = google.healthcare('v1'); const fs = require('fs'); const auth = await google.auth.getClient({ scopes: ['https://www.googleapis.com/auth/cloud-platform'], }); google.options({auth, headers: {'Content-Type': 'application/fhir+json'}}); const resource = await healthcare.projects.locations.datasets.fhirStores.fhir.executeBundle( request );
const healthcare = google.healthcare('v1'); const auth = await google.auth.getClient({ scopes: ['https://www.googleapis.com/auth/cloud-platform'], }); google.options({auth, headers: {'Content-Type': 'application/json-patch+json'}}); }; const resource = await healthcare.projects.locations.datasets.fhirStores.fhir.patch( request, );
const healthcare = google.healthcare('v1'); const auth = await google.auth.getClient({ scopes: ['https://www.googleapis.com/auth/cloud-platform'], }); }; google.options({auth, headers: {'Content-Type': 'application/fhir+json'}}); const resource = await healthcare.projects.locations.datasets.fhirStores.fhir.create( request );
/** * Get a valid access token. */ // [START retrieve_access_token] function getAccessToken() { return new Promise(function(resolve, reject) { const key = require('../placeholders/service-account.json'); const jwtClient = new google.auth.JWT( key.client_email, null, key.private_key, SCOPES, null ); jwtClient.authorize(function(err, tokens) { if (err) { reject(err); return; } resolve(tokens.access_token); }); }); }
/** * @return {Promise} Array of names of running instances */ const _listStoppedInstances = async (projectId, zone) => { const res = await compute.instances.list({ project: projectId, zone: zone, }); const instances = res.data.items || []; const stoppedInstances = instances.filter(item => item.status !== 'RUNNING'); return stoppedInstances.map(item => item.name); }
/** * Determine whether billing is enabled for a project * @param {string} projectName Name of project to check if billing is enabled * @return {bool} Whether project has billing enabled or not */ const _isBillingEnabled = async projectName => { const res = await billing.getBillingInfo({name: projectName}); return res.data.billingEnabled; }
constructor (config) { this.api = google.youtube({ version: 'v3', auth: config.youtube_api_key }) }
drive.files.export( { fileId, mimeType: 'text/csv', }, (err, res) => { if (err) return reject(err); return resolve(res); }, );
const genAuthUrl = (options, stateUrl) => { const client = getClient(options); const opts = { access_type: 'offline', scope: AUTH_SCOPES, state: stateUrl, }; if (isV2AuthApi(google.auth.OAuth2.GOOGLE_OAUTH2_AUTH_BASE_URL_)) { opts.prompt = 'consent'; } else { opts.approval_prompt = 'force'; } return client.generateAuthUrl(opts); }
/** * Disable billing for a project by removing its billing account * @param {string} projectName Name of project disable billing on * @return {string} Text containing response from disabling billing */ const _disableBillingForProject = async projectName => { const res = await billing.updateBillingInfo({ name: projectName, resource: {billingAccountName: ''}, // Disable billing }); return `Billing disabled: ${JSON.stringify(res.data)}`; }
/** * Get a valid access token. */ // [START retrieve_access_token] function getAccessToken() { return new Promise(function(resolve, reject) { const key = require('../placeholders/service-account.json'); const jwtClient = new google.auth.JWT( key.client_email, null, key.private_key, SCOPES, null ); jwtClient.authorize(function(err, tokens) { if (err) { reject(err); return; } resolve(tokens.access_token); }); }); }
/** * @return {Promise} Array of names of running instances */ const _listRunningInstances = async (projectId, zone) => { const res = await compute.instances.list({ project: projectId, zone: zone, }); const instances = res.data.items || []; const ranInstances = instances.filter(item => item.status === 'RUNNING'); return ranInstances.map(item => item.name); }