At the bottom of the page that you linked you will find a sample code in different languages to call that API by building a client. For example a sample code for Node.js
would look like this:
const {google} = require('googleapis');
var sqlAdmin = google.sqladmin('v1beta4');
authorize(function(authClient) {
var request = {
// Project ID of the project that contains the instance to be exported.
project: 'my-project', // TODO: Update placeholder value.
// Cloud SQL instance ID. This does not include the project ID.
instance: 'my-instance', // TODO: Update placeholder value.
resource: {
// TODO: Add desired properties to the request body.
},
auth: authClient,
};
sqlAdmin.instances.export(request, function(err, response) {
if (err) {
console.error(err);
return;
}
// TODO: Change code below to process the `response` object:
console.log(JSON.stringify(response, null, 2));
});
});
function authorize(callback) {
google.auth.getApplicationDefault(function(err, authClient) {
if (err) {
console.error('authentication failed: ', err);
return;
}
if (authClient.createScopedRequired && authClient.createScopedRequired()) {
var scopes = ['https://www.googleapis.com/auth/cloud-platform'];
authClient = authClient.createScoped(scopes);
}
callback(authClient);
});
}
To connect to a Cloud SQL instance from Cloud Function follow the documentation here.