Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

dnsimple_cli

A cli for the DNSimple v2 API. This is not a complete API implementation. It should be great to use as a simple dynamic dns client.

Install

There is no install, it's just bash! Well, that's not true.

Dependencies

  1. curl
  2. jq
  3. dig
    • Part of macOS
    • On Linux it's usually the dnsutils package
  4. bash version >= 4
    • If you're really stuck with bash v3.something, let me know and I'll take all the love and joy out of the script for you. ;)

Setup

  1. Login to DNSimple
  2. Go to your Account page (not your Settings)
  3. Go to Access Tokens
  4. Create an account access token.
  5. Add that to your .bashrc, .zshenv, etc...
    • export DNSIMPLE_ACCOUNT_TOKEN="The token from DNSimple"
  6. Reload your shell: exec bash, exec zsh, etc...

Usage

Help

$ ./dnsimple -h
Usage: dnsimple <command> [options] [command specific options]
  OPTIONS:
  -h, --help            This.

  --dat,                Specify a \$DNSIMPLE_ACCOUNT_TOKEN, in lieu of or to
  --account-token       override the setting from your environment.
                        You can create 'User access token' on your dnsimple.com
                        User Settings page.

  --api                 Override the default v2 API URL. The default is:
                        $_api

  --compact             Don't show the full json output.

  COMMANDS:
    whoami              Prints info for your \$DNSIMPLE_ACCOUNT_TOKEN.

    zones               Prints available zones.

    zone_info           Prints info for a specific zone.
      -z, --zone <zone name>

    zone_records        Prints records for a specific zone.
      -z, --zone <zone name>

    zone_record         Prints info for a specific zone record.
      -z, --zone <zone name>
      -r, --record <record name>

    zone_record_id      Prints the id for a specific zone record.
      -z, --zone <zone name>
      -r, --record <record name>

    update_a_record     Creates/Updates the zone record with an IP address.
                        Specifying an IP address of "auto" will detect and use
                        the current public internet IP.
      -z, --zone <zone name>
      -r, --record <record name>
      -i, --ip <IP or "auto">

whoami

$ ./dnsimple whoami
{
  "data": {
    "user": null,
    "account": {
      "id": ***Your Account ID***,
      "email": "***Your Email Address***",
      "created_at": "2010-11-16T14:19:28.219Z",
      "updated_at": "2016-02-22T11:04:09.404Z"
    }
  }
}

zones

$ ./dnsimple zones --account-id auto

# Pretty JSON of your available zones.

update_a_record

Read that as "update an A record" which is really my goal use case, as a dynamic DNS update client.

$ ./dnsimple update_a_record --zone chorn.net --record derp3 --ip auto
{
  "data": {
    "id": 5544144,
    "zone_id": "chorn.net",
    "parent_id": null,
    "name": "derp3",
    "content": "173.84.105.46",
    "ttl": 3600,
    "priority": null,
    "type": "A",
    "system_record": false,
    "created_at": "2016-04-05T11:43:39.691Z",
    "updated_at": "2016-04-12T10:50:59.576Z"
  }
}

Todo

  1. Update other record types.

About

A cli for the DNSimple v2 API.

Resources

License

Packages

No packages published

Languages