Giter VIP home page Giter VIP logo

domains's Introduction

Torus Tools - Domains

A promise-based javascript SDK that standarizes interactions with various different domain registrars providers.

Currently Supporting

  • AWS
  • Godaddy

If you are interested in adding new providers create the feature request and we will add it to our pipeline; or feel free to submit your own PR ๐Ÿ˜Ž

Records Format

the records parameter has the following format

{
  name:"example.com",  //traffic coming into (root domain or sub-domain)
  data: "192.0.2.44",  //route traffic to somewhere (an ip or resource ARN)
  type: "CNAME",  //type of record.
  ttl: 3600   //ttl for the record if required
  alias: true|false   //depending on this value the record will either have a resourceRecords attribute or an aliasTarget attribute in AWS
}

Record Types

  • A
  • AAAA
  • CAA
  • CNAME
  • MX
  • NAPTR
  • NS
  • PTR
  • SOA
  • SPF
  • SRV
  • TXT

API

The API standardizes operations accross different providers. As shown in the example below, all of the methods must be used in the format [PROVIDER].method

const {godaddy} = require('@torus-tools/domains')

godaddy.getNameservers('mydomain.com')
.then(data=> console.log(data))
.catch(err=>console.log(err))

getNameservers(domain)

  • description: gets the nameservers for a particular domain
  • params: (domain)
    • domain: STRING: REQUIRED: the root domain of your site i.e. yoursite.com
  • returns: promise(resolve, reject)
    • resolve: (nameservers)
      • nameservers: an array of nameserver addresses
    • reject: (error)

updateNameservers(domain, nameservers)

  • description: updates the nameservers for a particular domain
  • params: (domain, nameservers)
    • domain: STRING: REQUIRED: the root domain of your site i.e. yoursite.com
    • nameservers: ARRAY: REQUIRED: an array of nameserver strings
  • returns: promise(resolve, reject)
    • resolve: ('All Done')
      • nameservers: an array of nameserver addresses
    • reject: (error)

listRecords(domain)

  • description: Lists the records of a particular domain
  • params: (domain)
    • domain: STRING: REQUIRED: the root domain of your site i.e. yoursite.com
  • returns: promise(resolve, reject)
    • resolve: ('All Done')
      • recordSet: an object with the record set of the given domain
    • reject: (error)

upsertRecords(domain, records)

  • description: It will create or update the specified records for a given domain. If one of the records exists it will updated, otherwise it will be created.
  • params: (domain, records)
    • domain: STRING: REQUIRED: the root domain of your site i.e. yoursite.com
    • records: OBJECT: REQUIRED: the record set that includes:
      • Record name
      • Record type
      • Record data
      • Record ttl
  • returns: promise(resolve, reject)
    • resolve: ('All Done')
      • record: an array with the new record data that has been created or updated
    • reject: (error)

deleteRecords(domain, records)

  • description: deletes the specified records for a given domain.
  • params: (domain, records)
    • domain: STRING: REQUIRED: the root domain of your site i.e. yoursite.com
    • records: OBJECT: REQUIRED: the record sets that will be deleted
  • returns: promise(resolve, reject)
    • resolve: ('recordSet deleted')
      • recordSet: an object with the record set hat has been deleted
    • reject: (error)

deleteAllRecords(doamin, records)

  • description: Deletes all DNS records for a given domain.
  • params: (domain)
    • domain: STRING: REQUIRED: the root domain of your site i.e. yoursite.com
  • returns: promise(resolve, reject)
    • resolve: ('All recordSets deleted')
    • reject: (error)

createRedirect(domain, url)

  • description: creates a 301 redirect for the given domian to a specified url.
  • params: (domain, url)
    • domain: STRING: REQUIRED: the root domain of your site i.e. yoursite.com
    • url: STRING: REQUIRED: the url address you want to redirect
  • returns: promise(resolve, reject)
    • resolve: ('All Done')
      • type: a string with the value "REDIRECT_PERMANENT"
      • url: a string for the redirect url address
    • reject: (error)

addRecord(domain, records)

  • description: It will add the specified records to the given domain.
  • params: (domain, records)
    • domain: STRING: REQUIRED: the root domain of your site i.e. yoursite.com
    • records: OBJECT: REQUIRED: the record set that includes:
      • Record name
      • Record type
      • Record data
      • Record ttl
  • returns: promise(resolve, reject)
    • resolve: ('All Done')
      • record: an object with the record that has been added
    • reject: (error)

getZone(domain)

  • description: gets the DNS zone Id for a given domain.
  • params: (domain)
    • domain: STRING: REQUIRED: the root domain of your site i.e. yoursite.com
  • returns: promise(resolve, reject)
    • resolve: ('All Done')
      • HostedZones: An array with the hosted zone ID of given domain.
    • reject: ('no hosted zones exist for the given domain')

domains's People

Contributors

gkpty avatar lucaskardo avatar

Stargazers

 avatar

Watchers

 avatar  avatar

domains's Issues

upsert domains in godaddy

godaddy has a www CNAME record by default so the patch method fails as a CNAME with the same name already exists.

The method should first get all the existing records.

If a given record type with a given record name exists, use the put method

else use the patch methpd

purchase domains

This will allow users to purchase domains directly from the cli.

the domainPurchase will consist of 2 operations

  1. searchAvailableDomain(domain) returns an object {available:true, price:10.00}
  2. purchasDomain(domain)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.