Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@firstdorsal/powerdns-api

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@firstdorsal/powerdns-api

nodejs powerdns api wrapper

  • 1.0.3
  • npm
  • Socket score

Version published
Weekly downloads
11
decreased by-64.52%
Maintainers
1
Weekly downloads
 
Created
Source

Modules

powerdns-api

Typedefs

Search : object
Records : Array.<Record>
Record : object

powerdns-api

powerdns-api.PowerdnsClient

Class representing the powerdns client

Kind: static class of powerdns-api

new module.exports.PowerdnsClient(baseurl, apikey)

Create a powerdns client.

ParamTypeDescription
baseurlstringThe base url where the api can be found
apikeystringThe api key for the powerdns endpoint

Example

(async () => {
    require('dotenv').config();

    const {
        Powerdns
    } = require('powerdns-api');

    const pdns = new Powerdns(process.env.PDNS_API_ENDPOINT, process.env.PDNS_API_KEY);

    console.log(await pdns.getZone('example.com'));
})();

powerdnsClient.getZones() ⇒ Array

Returns array of zones on pdns server.

Kind: instance method of PowerdnsClient Returns: Array - - array of zones on the server Example

await pdns.getZones();

powerdnsClient.getZoneWithMeta(zoneName) ⇒ object

Returns single zone with meta information.

Kind: instance method of PowerdnsClient Returns: object - - the zone with meta information

ParamTypeDescription
zoneNamestringtakes a domain name

Example

await pdns.getZoneWithMeta();

powerdnsClient.getZone(zoneName) ⇒ object

Returns array with rrsets.

Kind: instance method of PowerdnsClient Returns: object - - just the rrsets of the zone

ParamTypeDescription
zoneNamestringtakes a domain name

Example

await pdns.getZone('example.com');

powerdnsClient.setRecords(records) ⇒ boolean

Takes records as array and sets them. If records exist it replaces them.

Kind: instance method of PowerdnsClient Returns: boolean - - boolean indicating the success of the operation

ParamTypeDescription
recordsRecordsarray containing the records

Example

await pdns.setRecords([{
           name: "example.com",
           type: "A",
           ttl: 300,
           content: ['1.1.1.1']
       }]);

powerdnsClient.deleteRecords(records) ⇒ boolean

Takes records as array and deletes them.

Kind: instance method of PowerdnsClient Returns: boolean - - boolean indicating the success of the operation

ParamTypeDescription
recordsRecordsarray containing the records to be deleted

Example

await pdns.deleteRecords([{
           name: "example.com",
           type: "A"
       }]);

powerdnsClient.search(search) ⇒ object

takes object with query as string; searches for elements in pdns server; returns found elements as array; if max is not specified it defaults to 10 returned records; if object_type is not defined it defaults to the type "record"; must be awaited;

Kind: instance method of PowerdnsClient Returns: object - - search results

ParamTypeDescription
searchSearchobject with the query paramter

Example

await pdns.search({
           query: 'example.com',
           max: 100,
           object_type: "zone"
       });

powerdnsClient.appendRecord(record) ⇒ boolean

Takes ONE record as object and appends it not replacing other records with the same name.

Kind: instance method of PowerdnsClient Returns: boolean - - boolean indicating the success of the operation

ParamTypeDescription
recordRecordarray containing the records to be deleted

Example

await pdns.appendRecord({
           name: "example.com",
           type: "A",
           ttl: 300,
           content: ['1.1.1.1','2.2.2.2']
       });

Search : object

Kind: global typedef Properties

NameTypeDefaultDescription
querystringquery to search for
[max]number10limits the ammount of returned values
[object_type]string"record"for what kind of pdns object to search

Example

{query: 'example.com', max: 100, object_type: "zone"}

Records : Array.<Record>

Kind: global typedef Example

[{
    name: "example.com",
    type: "A",
    ttl: 300,
    content: ['1.1.1.1', '8.8.8.8']
}, {
    name: "*.example.com",
    type: "A",
    ttl: 300,
    content: ['1.1.1.1', '8.8.8.8']
}]

Record : object

Kind: global typedef Properties

NameTypeDescription
namestringkey name of the record
typestringtype of the record
ttlnumbertime to live of the record
contentArrayvalue array with content of the record

Example

{name: "example.com", type: "A", ttl: 300, content: ['1.1.1.1', '8.8.8.8']}

FAQs

Package last updated on 14 Aug 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc