Properties

new Record(type, metadata)

Example

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

const record = zone.record('a', {
  name: 'example.com.',
  ttl: 86400,
  data: '1.2.3.4'
});

Parameters

Name Type Optional Description

type

 

 

The record type, e.g. A, AAAA, MX.

metadata

 

 

The metadata of this record.

Values in metadata have the following properties:

Name Type Optional Description

name

 

 

The name of the record, e.g. www.example.com..

data

 

 

Defined in RFC 1035, section 5 and RFC 1034, section 3.6.1.

ttl

 

 

Seconds that the resource is cached by resolvers.

Properties

data  nullable Array of object

metadata  object

Properties

Name Type Optional Description

name

string

 

data

Array of string

 

metadata.ttl

number

 

type  string

Methods

delete([callback]) → Promise containing DeleteRecordResponse

Delete this record by creating a change on your zone. This is a convenience method for:

zone.createChange({
  delete: record
}, (err, change, apiResponse) => {});

Example

const {DNS} = require('@google-cloud/dns');
const dns = new DNS();
const zone = dns.zone('zone-id');
const record = zone.record('a', {
  name: 'example.com.',
  ttl: 86400,
  data: '1.2.3.4'
});

record.delete((err, change, apiResponse) => {
  if (!err) {
    // Delete change modification was created.
  }
});

//-
// If the callback is omitted, we'll return a Promise.
//-
record.delete().then((data) => {
  const change = data[0];
  const apiResponse = data[1];
});

Parameter

Name Type Optional Description

callback

DeleteRecordCallback

Yes

Callback function.

See also

ManagedZones: create API Documentation

Returns

Promise containing DeleteRecordResponse 

toJSON() → object

Serialize the record instance to the format the API expects.

Returns

object 

toString() → string

Convert the record to a string, formatted for a zone file.

Returns

string