Reputation: 4289
I am using this gcloud command to stop my sql instance following this
gcloud sql instances patch my-sql-instance --activation-policy NEVER
how can I achieve the same in nodejs code?
is there a google library for the sql api in npm?
Upvotes: 0
Views: 395
Reputation: 4289
using googleapis
see also the api reference
const {google} = require('googleapis');
const {auth} = require('google-auth-library');
const sqladmin = google.sqladmin('v1beta4');
auth.getApplicationDefault((_err, authRes) => {
var req = {
auth: authRes.credential,
project: "my-project-id",
instance: "my-instance",
requestBody: {
"settings": {
"activationPolicy": "NEVER"
}
}
};
sqladmin.instances.patch(req, (err, res) => {
if (err) console.error(err);
if (res) console.info(res);
})
});
Upvotes: 1