Class DNS (4.0.0)

[Cloud DNS]( https://cloud.google.com/dns/what-is-cloud-dns ) is a high-performance, resilient, global DNS service that provides a cost-effective way to make your applications and services available to your users. This programmable, authoritative DNS service can be used to easily publish and manage DNS records using the same infrastructure relied upon by Google.

Inheritance

Service > DNS

Package

@google-cloud/dns

Examples

Import the client library const {DNS} = require('@google-cloud/dns');

Create a client that uses a href="https://cloud.google.com/docs/authentication/production#providing_credentials_to_your_application" Application Default Credentials (ADC): const dns = new DNS();

Create a client with a href="https://cloud.google.com/docs/authentication/production#obtaining_and_providing_service_account_credentials_manually" explicit credentials: const dns = new DNS({ projectId: 'your-project-id', keyFilename: '/path/to/keyfile.json' });

Full quickstart example:

   
 // 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 
 (); 
 

Constructors

(constructor)(options)

  constructor 
 ( 
 options 
 ?: 
  
 DNSOptions 
 ); 
 

Constructs a new instance of the DNS class

Parameter
Name
Description
options

Properties

getZonesStream

  getZonesStream 
 : 
  
 ( 
 query 
 : 
  
 GetZonesRequest 
 ) 
  
 = 
>  
 Stream 
 ; 
 

Methods

createZone(name, config)

  createZone 
 ( 
 name 
 : 
  
 string 
 , 
  
 config 
 : 
  
 CreateZoneRequest 
 ) 
 : 
  
 Promise<CreateZoneResponse> 
 ; 
 
Parameters
Name
Description
name
string
Returns
Type
Description
Promise < CreateZoneResponse >

createZone(name, config, callback)

  createZone 
 ( 
 name 
 : 
  
 string 
 , 
  
 config 
 : 
  
 CreateZoneRequest 
 , 
  
 callback 
 : 
  
 GetZoneCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
name
string
callback
Returns
Type
Description
void

getZones(query)

  getZones 
 ( 
 query 
 ?: 
  
 GetZonesRequest 
 ) 
 : 
  
 Promise<GetZonesResponse> 
 ; 
 
Parameter
Name
Description
Returns
Type
Description
Promise < GetZonesResponse >

getZones(callback)

  getZones 
 ( 
 callback 
 : 
  
 GetZonesCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameter
Name
Description
callback
Returns
Type
Description
void

getZones(query, callback)

  getZones 
 ( 
 query 
 : 
  
 GetZonesRequest 
 , 
  
 callback 
 : 
  
 GetZonesCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
callback
Returns
Type
Description
void

zone(name)

  zone 
 ( 
 name 
 : 
  
 string 
 ) 
 : 
  
 Zone 
 ; 
 

Get a reference to a Zone.

Parameter
Name
Description
name
string

The unique name of the zone.

Returns
Type
Description

{Zone}

Example

const {DNS} = require('@google-cloud/dns'); const dns = new DNS();

const zone = dns.zone('my-zone');

Design a Mobile Site
View Site in Mobile | Classic
Share by: