// Before running the sample:
// - Enable the API at:
// https://console.developers.google.com/apis/api/servicenetworking.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 servicenetworking = google.servicenetworking('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/service.management',
],
});
// 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 servicenetworking.services.projects.global.networks.peeredDnsDomains.create(
{
// Required. Parent resource identifying the connection for which the peered DNS domain will be created in the format: `services/{service\}/projects/{project\}/global/networks/{network\}` {service\} is the peering service that is managing connectivity for the service producer's organization. For Google services that support this functionality, this value is `servicenetworking.googleapis.com`. {project\} is the number of the project that contains the service consumer's VPC network e.g. `12345`. {network\} is the name of the service consumer's VPC network.
parent:
'services/my-service/projects/my-project/global/networks/my-network',
// Request body metadata
requestBody: {
// request body parameters
// {
// "dnsSuffix": "my_dnsSuffix",
// "name": "my_name"
// }
},
}
);
console.log(res.data);
// Example response
// {
// "done": false,
// "error": {},
// "metadata": {},
// "name": "my_name",
// "response": {}
// }
}
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.resourceRecordSets.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 managed zone addressed by this request. Can be the managed zone name or ID.
managedZone: 'placeholder-value',
// Identifies the project addressed by this request.
project: 'placeholder-value',
// Request body metadata
requestBody: {
// request body parameters
// {
// "kind": "my_kind",
// "name": "my_name",
// "routingPolicy": {},
// "rrdatas": [],
// "signatureRrdatas": [],
// "ttl": 0,
// "type": "my_type"
// }
},
});
console.log(res.data);
// Example response
// {
// "kind": "my_kind",
// "name": "my_name",
// "routingPolicy": {},
// "rrdatas": [],
// "signatureRrdatas": [],
// "ttl": 0,
// "type": "my_type"
// }
}
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.managedZones.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
// {
// "creationTime": "my_creationTime",
// "description": "my_description",
// "dnsName": "my_dnsName",
// "dnssecConfig": {},
// "forwardingConfig": {},
// "id": "my_id",
// "kind": "my_kind",
// "labels": {},
// "name": "my_name",
// "nameServerSet": "my_nameServerSet",
// "nameServers": [],
// "peeringConfig": {},
// "privateVisibilityConfig": {},
// "reverseLookupConfig": {},
// "serviceDirectoryConfig": {},
// "visibility": "my_visibility"
// }
},
});
console.log(res.data);
// Example response
// {
// "creationTime": "my_creationTime",
// "description": "my_description",
// "dnsName": "my_dnsName",
// "dnssecConfig": {},
// "forwardingConfig": {},
// "id": "my_id",
// "kind": "my_kind",
// "labels": {},
// "name": "my_name",
// "nameServerSet": "my_nameServerSet",
// "nameServers": [],
// "peeringConfig": {},
// "privateVisibilityConfig": {},
// "reverseLookupConfig": {},
// "serviceDirectoryConfig": {},
// "visibility": "my_visibility"
// }
}
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.managedZones.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
// {
// "creationTime": "my_creationTime",
// "description": "my_description",
// "dnsName": "my_dnsName",
// "dnssecConfig": {},
// "forwardingConfig": {},
// "id": "my_id",
// "kind": "my_kind",
// "labels": {},
// "name": "my_name",
// "nameServerSet": "my_nameServerSet",
// "nameServers": [],
// "peeringConfig": {},
// "privateVisibilityConfig": {},
// "reverseLookupConfig": {},
// "serviceDirectoryConfig": {},
// "visibility": "my_visibility"
// }
},
});
console.log(res.data);
// Example response
// {
// "creationTime": "my_creationTime",
// "description": "my_description",
// "dnsName": "my_dnsName",
// "dnssecConfig": {},
// "forwardingConfig": {},
// "id": "my_id",
// "kind": "my_kind",
// "labels": {},
// "name": "my_name",
// "nameServerSet": "my_nameServerSet",
// "nameServers": [],
// "peeringConfig": {},
// "privateVisibilityConfig": {},
// "reverseLookupConfig": {},
// "serviceDirectoryConfig": {},
// "visibility": "my_visibility"
// }
}
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.resourceRecordSets.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 managed zone addressed by this request. Can be the managed zone name or ID.
managedZone: 'placeholder-value',
// Fully qualified domain name.
name: 'placeholder-value',
// Identifies the project addressed by this request.
project: 'placeholder-value',
// RRSet type.
type: 'placeholder-value',
});
console.log(res.data);
// Example response
// {}
}
main().catch(e => {
console.error(e);
throw e;
});