gcp coustomize billing dashboard using typescript

Requirement-

Solution Approach-

Tech stack -


Workflow-


business logic example

//google Service Account impersonation

const client = await auth.getClient();

let targetPrincipal = 'googlebigquery@xxxx.iam.gserviceaccount.com'

const targetClient = new Impersonated({

sourceClient: client,

targetPrincipal: targetPrincipal,

lifetime: 30,

delegates: [],

targetScopes: [scopes] });

//End

const url = 'https://bigquery.googleapis.com/bigquery/v2/projects/${projectId}/queries'

const res = await targetClient.request({

url,method:'POST', headers:{

'Content-type':'application/json; charset=UTF-8',

},

body: JSON.stringfy({

"query": 'select xxxxx from table name'

"useLegacySql": false }),

});

response.json({responseData.data})


Example (Create Service-account and impersonate for secure access)