Constructor

Record

new Record(type, metadata)

Create a Resource Record object.

Parameter

type

string

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

metadata

object

The metadata of this record.

Values in metadata have the following properties:

Parameter

name

string

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

data

Array of string

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

ttl

number

Seconds that the resource is cached by resolvers.

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'
});

Properties

data

nullable Array of object

metadata

object

Properties

Parameter

name

string

data

Array of string

metadata.ttl

number

type

string

Methods

delete

delete(callback) returns Promise containing DeleteRecordResponse

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

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

Parameter

callback

Optional

DeleteRecordCallback

Callback function.

See also

ManagedZones: create API Documentation

Returns

Promise containing DeleteRecordResponse 

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(function(err, change, apiResponse) {
  if (!err) {
    // Delete change modification was created.
  }
});

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

toJSON

toJSON() returns object

Serialize the record instance to the format the API expects.

Returns

object 

toString

toString() returns string

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

Returns

string