Change
Source: change.
new Change(zone, id)
Example
const {DNS} = require('@google-cloud/dns');
const dns = new DNS();
const zone = dns.zone('zone-id');
const change = zone.change('change-id');
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
zone |
|
|
The parent zone object. |
|
id |
|
|
ID of the change. |
Properties
id string
metadata object
Methods
create(config[, callback]) → Promise containing CreateChangeResponse
Create a change.
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, (err, change, apiResponse) => {
if (!err) {
// The change was created successfully.
}
});
//-
// If the callback is omitted, we'll return a Promise.
//-
change.create(config).then((data) => {
const change = data[0];
const apiResponse = data[1];
});
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
|
config |
CreateChangeRequest |
|
The configuration object. |
|
callback |
CreateChangeCallback |
Yes |
Callback function. |
- Returns
-
Promise containing CreateChangeResponse
exists([callback]) → Promise containing ChangeExistsResponse
Check if the change exists.
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((err, exists) => {});
//-
// If the callback is omitted, we'll return a Promise.
//-
change.exists().then((data) => {
const exists = data[0];
});
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
callback |
Yes |
Callback function. |
- Returns
-
Promise containing ChangeExistsResponse
get([options][, callback]) → 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.
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((err, change, apiResponse) => {
// `change.metadata` has been populated.
});
//-
// If the callback is omitted, we'll return a Promise.
//-
change.get().then((data) => {
const change = data[0];
const apiResponse = data[1];
});
Parameters
| Name | Type | Optional | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
options |
options |
Yes |
Configuration object. Values in
|
||||||||
|
callback |
Yes |
Callback function. |
- Returns
-
Promise containing GetChangeResponse
getMetadata([callback]) → Promise containing GetChangeMetadataResponse
Get the metadata for the change in the zone.
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((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((data) => {
const metadata = data[0];
const apiResponse = data[1];
});
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
callback |
Yes |
Callback function. |
- See also
- Returns
-
Promise containing GetChangeMetadataResponse