// Before running the sample:
// - Enable the API at:
// https://console.developers.google.com/apis/api/dns.googleapis.com
// - Login into gcloud by running:
// `$ gcloud auth application-default login`
// - Install the npm module by running:
// `$ npm install googleapis`
const {google} = require('googleapis');
const dns = google.dns('v1beta2');
async function main() {
const auth = new google.auth.GoogleAuth({
// Scopes can be specified either as an array or as a single, space-delimited string.
scopes: [
'https://www.googleapis.com/auth/cloud-platform',
'https://www.googleapis.com/auth/ndev.clouddns.readwrite',
],
});
// Acquire an auth client, and bind it to all future calls
const authClient = await auth.getClient();
google.options({auth: authClient});
// Do the magic
const res = await dns.policies.create({
// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection.
clientOperationId: 'placeholder-value',
// Identifies the project addressed by this request.
project: 'placeholder-value',
// Request body metadata
requestBody: {
// request body parameters
// {
// "alternativeNameServerConfig": {},
// "description": "my_description",
// "enableInboundForwarding": false,
// "enableLogging": false,
// "id": "my_id",
// "kind": "my_kind",
// "name": "my_name",
// "networks": []
// }
},
});
console.log(res.data);
// Example response
// {
// "alternativeNameServerConfig": {},
// "description": "my_description",
// "enableInboundForwarding": false,
// "enableLogging": false,
// "id": "my_id",
// "kind": "my_kind",
// "name": "my_name",
// "networks": []
// }
}
main().catch(e => {
console.error(e);
throw e;
});
// Before running the sample:
// - Enable the API at:
// https://console.developers.google.com/apis/api/dns.googleapis.com
// - Login into gcloud by running:
// `$ gcloud auth application-default login`
// - Install the npm module by running:
// `$ npm install googleapis`
const {google} = require('googleapis');
const dns = google.dns('v1');
async function main() {
const auth = new google.auth.GoogleAuth({
// Scopes can be specified either as an array or as a single, space-delimited string.
scopes: [
'https://www.googleapis.com/auth/cloud-platform',
'https://www.googleapis.com/auth/ndev.clouddns.readwrite',
],
});
// Acquire an auth client, and bind it to all future calls
const authClient = await auth.getClient();
google.options({auth: authClient});
// Do the magic
const res = await dns.policies.create({
// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection.
clientOperationId: 'placeholder-value',
// Identifies the project addressed by this request.
project: 'placeholder-value',
// Request body metadata
requestBody: {
// request body parameters
// {
// "alternativeNameServerConfig": {},
// "description": "my_description",
// "enableInboundForwarding": false,
// "enableLogging": false,
// "id": "my_id",
// "kind": "my_kind",
// "name": "my_name",
// "networks": []
// }
},
});
console.log(res.data);
// Example response
// {
// "alternativeNameServerConfig": {},
// "description": "my_description",
// "enableInboundForwarding": false,
// "enableLogging": false,
// "id": "my_id",
// "kind": "my_kind",
// "name": "my_name",
// "networks": []
// }
}
main().catch(e => {
console.error(e);
throw e;
});
// Before running the sample:
// - Enable the API at:
// https://console.developers.google.com/apis/api/dns.googleapis.com
// - Login into gcloud by running:
// `$ gcloud auth application-default login`
// - Install the npm module by running:
// `$ npm install googleapis`
const {google} = require('googleapis');
const dns = google.dns('v1beta2');
async function main() {
const auth = new google.auth.GoogleAuth({
// Scopes can be specified either as an array or as a single, space-delimited string.
scopes: [
'https://www.googleapis.com/auth/cloud-platform',
'https://www.googleapis.com/auth/ndev.clouddns.readwrite',
],
});
// Acquire an auth client, and bind it to all future calls
const authClient = await auth.getClient();
google.options({auth: authClient});
// Do the magic
const res = await dns.responsePolicyRules.create({
// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection.
clientOperationId: 'placeholder-value',
// Identifies the project addressed by this request.
project: 'placeholder-value',
// User assigned name of the Response Policy containing the Response Policy Rule.
responsePolicy: 'placeholder-value',
// Request body metadata
requestBody: {
// request body parameters
// {
// "behavior": "my_behavior",
// "dnsName": "my_dnsName",
// "kind": "my_kind",
// "localData": {},
// "ruleName": "my_ruleName"
// }
},
});
console.log(res.data);
// Example response
// {
// "behavior": "my_behavior",
// "dnsName": "my_dnsName",
// "kind": "my_kind",
// "localData": {},
// "ruleName": "my_ruleName"
// }
}
main().catch(e => {
console.error(e);
throw e;
});
// Before running the sample:
// - Enable the API at:
// https://console.developers.google.com/apis/api/dns.googleapis.com
// - Login into gcloud by running:
// `$ gcloud auth application-default login`
// - Install the npm module by running:
// `$ npm install googleapis`
const {google} = require('googleapis');
const dns = google.dns('v1beta2');
async function main() {
const auth = new google.auth.GoogleAuth({
// Scopes can be specified either as an array or as a single, space-delimited string.
scopes: [
'https://www.googleapis.com/auth/cloud-platform',
'https://www.googleapis.com/auth/ndev.clouddns.readwrite',
],
});
// Acquire an auth client, and bind it to all future calls
const authClient = await auth.getClient();
google.options({auth: authClient});
// Do the magic
const res = await dns.responsePolicyRules.delete({
// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection.
clientOperationId: 'placeholder-value',
// Identifies the project addressed by this request.
project: 'placeholder-value',
// User assigned name of the Response Policy containing the Response Policy Rule.
responsePolicy: 'placeholder-value',
// User assigned name of the Response Policy Rule addressed by this request.
responsePolicyRule: 'placeholder-value',
});
console.log(res.data);
}
main().catch(e => {
console.error(e);
throw e;
});
// Before running the sample:
// - Enable the API at:
// https://console.developers.google.com/apis/api/dns.googleapis.com
// - Login into gcloud by running:
// `$ gcloud auth application-default login`
// - Install the npm module by running:
// `$ npm install googleapis`
const {google} = require('googleapis');
const dns = google.dns('v1beta2');
async function main() {
const auth = new google.auth.GoogleAuth({
// Scopes can be specified either as an array or as a single, space-delimited string.
scopes: [
'https://www.googleapis.com/auth/cloud-platform',
'https://www.googleapis.com/auth/cloud-platform.read-only',
'https://www.googleapis.com/auth/ndev.clouddns.readonly',
'https://www.googleapis.com/auth/ndev.clouddns.readwrite',
],
});
// Acquire an auth client, and bind it to all future calls
const authClient = await auth.getClient();
google.options({auth: authClient});
// Do the magic
const res = await dns.responsePolicyRules.get({
// For mutating operation requests only. An optional identifier specified by the client. Must be unique for operation resources in the Operations collection.
clientOperationId: 'placeholder-value',
// Identifies the project addressed by this request.
project: 'placeholder-value',
// User assigned name of the Response Policy containing the Response Policy Rule.
responsePolicy: 'placeholder-value',
// User assigned name of the Response Policy Rule addressed by this request.
responsePolicyRule: 'placeholder-value',
});
console.log(res.data);
// Example response
// {
// "behavior": "my_behavior",
// "dnsName": "my_dnsName",
// "kind": "my_kind",
// "localData": {},
// "ruleName": "my_ruleName"
// }
}
main().catch(e => {
console.error(e);
throw e;
});