Change
Constructor
Change
new Change(zone, id)
Parameter |
|
---|---|
zone |
The parent zone object. |
id |
string ID of the change. |
Example
const DNS = require('@google-cloud/dns');
const dns = new DNS();
const zone = dns.zone('zone-id');
const change = zone.change('change-id');
Properties
id
string
metadata
object
Methods
create
create(config, callback) returns Promise containing CreateChangeResponse
Create a change.
Parameter |
|
---|---|
config |
The configuration object. |
callback |
Optional Callback function. |
- Returns
-
Promise containing CreateChangeResponse
Example
const DNS = require('@google-cloud/dns');
const dns = new DNS();
const zone = dns.zone('zone-id');
const change = zone.change('change-id');
const config = {
add: {
// ...
}
};
change.create(config, function(err, change, apiResponse) {
if (!err) {
// The change was created successfully.
}
});
//-
// If the callback is omitted, we'll return a Promise.
//-
change.create(config).then(function(data) {
const change = data[0];
const apiResponse = data[1];
});
exists
exists(callback) returns Promise containing ChangeExistsResponse
Check if the change exists.
Parameter |
|
---|---|
callback |
Optional Callback function. |
- Returns
-
Promise containing ChangeExistsResponse
Example
const DNS = require('@google-cloud/dns');
const dns = new DNS();
const zone = dns.zone('zone-id');
const change = zone.change('change-id');
change.exists(function(err, exists) {});
//-
// If the callback is omitted, we'll return a Promise.
//-
change.exists().then(function(data) {
var exists = data[0];
});
get
get(options, callback) returns Promise containing GetChangeResponse
Get a change if it exists.
You may optionally use this to "get or create" an object by providing an object with autoCreate
set to true
. Any extra configuration that is normally required for the create
method must be
contained within this object as well.
Parameter |
|||||
---|---|---|---|---|---|
options |
Optional options Configuration object. Values in
|
||||
callback |
Optional Callback function. |
- Returns
-
Promise containing GetChangeResponse
Example
const DNS = require('@google-cloud/dns');
const dns = new DNS();
const zone = dns.zone('zone-id');
const change = zone.change('change-id');
change.get(function(err, change, apiResponse) {
// `change.metadata` has been populated.
});
//-
// If the callback is omitted, we'll return a Promise.
//-
change.get().then(function(data) {
var change = data[0];
var apiResponse = data[1];
});
getMetadata
getMetadata(callback) returns Promise containing GetChangeMetadataResponse
Get the metadata for the change in the zone.
Parameter |
|
---|---|
callback |
Optional Callback function. |
- See also
- Returns
-
Promise containing GetChangeMetadataResponse
Example
const DNS = require('@google-cloud/dns');
const dns = new DNS();
const zone = dns.zone('zone-id');
const change = zone.change('change-id');
change.getMetadata(function(err, metadata, apiResponse) {
if (!err) {
// metadata = {
// kind: 'dns#change',
// additions: [{...}],
// deletions: [{...}],
// startTime: '2015-07-21T14:40:06.056Z',
// id: '1',
// status: 'done'
// }
}
});
//-
// If the callback is omitted, we'll return a Promise.
//-
change.getMetadata().then(function(data) {
var metadata = data[0];
var apiResponse = data[1];
});