How to use @google-cloud/dns - 4 common examples

To help you get started, we’ve selected a few @google-cloud/dns examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github googleapis / nodejs-dns / samples / quickstart.js View on Github external
async function main() {
  // [START dns_quickstart]
  // Imports the Google Cloud client library
  const {DNS} = require('@google-cloud/dns');

  // Creates a client
  const dns = new DNS();

  async function quickstart() {
    // Lists all zones in the current project
    const [zones] = await dns.getZones();
    console.log('Zones:');
    zones.forEach(zone => console.log(zone.name));
  }
  quickstart();
  // [END dns_quickstart]
}
github googleapis / nodejs-dns / samples / listZones.js View on Github external
async function main() {
  // [START dns_list_zones]
  // Imports the Google Cloud client library
  const {DNS} = require('@google-cloud/dns');

  // Creates a client
  const dns = new DNS();

  async function listZones() {
    // Lists all zones in the current project
    const [zones] = await dns.getZones();
    console.log('Zones:');
    zones.forEach(zone => console.log(zone.name));
  }
  listZones();
  // [END dns_list_zones]
}
github OriginProtocol / origin / origin-dapp-creator-server / src / lib / dns.js View on Github external
const { DNS } = require('@google-cloud/dns')

const dns = new DNS({ projectId: process.env.GCLOUD_PROJECT })
const zone = dns.zone(process.env.GCLOUD_DNS_ZONE || 'test-zone')

export const subdomainBlacklist = ['admin', 'login', 'system', 'account']

/* Generates the DNS name of the CNAME and TXT entries.
 *
 * e.g. marketplace.origindapp.com
 *
 * @param {string} subdomain The subdomain of the DNS record.
 * @param {string} recordType The DNS record type.
 */
function getDnsName(subdomain, recordType) {
  const baseName = `${subdomain}.${
    process.env.DAPP_CREATOR_DOMAIN
  }.`.toLowerCase()
  if (recordType.toLowerCase() === 'cname') {
github srueg / dynamic-cloud-dns / index.js View on Github external
/*jshint esversion: 6 */

const ipHelper = require('ip');
const {DNS} = require('@google-cloud/dns');
const settings = require('./settings.json');

const dns = new DNS();
/**
 * HTTP Cloud Function.
 *
 * @param {Object} req Cloud Function request context.
 * @param {Object} res Cloud Function response context.
 */
exports.updateHost = function helloGET(req, res) {
    var token = req.query.token || req.body.token;
    var ipv4 = req.query.ipv4 || req.body.ipv4;
    var ipv6 = req.query.ipv6 || req.body.ipv6;
    var host = req.query.host || req.body.host;

    if (token != settings.secretToken) {
        respondWithError(401, 'unauthorized', 'Login Required', res);
        return;
    }

@google-cloud/dns

Cloud DNS Client Library for Node.js

Apache-2.0
Latest version published 1 year ago

Package Health Score

56 / 100
Full package analysis

Popular @google-cloud/dns functions