Record
Source: record.
Create a Resource Record object.
Methods
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. |
||||||||||||||||
|
metadata |
|
|
The metadata of this record. Values in
|
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
- 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