Class: Fog::DNS::DNSMadeEasy::Real
- Inherits:
-
Object
- Object
- Fog::DNS::DNSMadeEasy::Real
- Defined in:
- lib/fog/dnsmadeeasy/dns.rb,
lib/fog/dnsmadeeasy/requests/dns/get_domain.rb,
lib/fog/dnsmadeeasy/requests/dns/get_record.rb,
lib/fog/dnsmadeeasy/requests/dns/list_domains.rb,
lib/fog/dnsmadeeasy/requests/dns/list_records.rb,
lib/fog/dnsmadeeasy/requests/dns/create_domain.rb,
lib/fog/dnsmadeeasy/requests/dns/create_record.rb,
lib/fog/dnsmadeeasy/requests/dns/delete_domain.rb,
lib/fog/dnsmadeeasy/requests/dns/delete_record.rb,
lib/fog/dnsmadeeasy/requests/dns/get_secondary.rb,
lib/fog/dnsmadeeasy/requests/dns/update_record.rb,
lib/fog/dnsmadeeasy/requests/dns/list_secondary.rb,
lib/fog/dnsmadeeasy/requests/dns/create_secondary.rb,
lib/fog/dnsmadeeasy/requests/dns/delete_secondary.rb,
lib/fog/dnsmadeeasy/requests/dns/update_secondary.rb,
lib/fog/dnsmadeeasy/requests/dns/delete_all_domains.rb,
lib/fog/dnsmadeeasy/requests/dns/delete_all_secondary.rb
Instance Method Summary collapse
-
#create_domain(domain) ⇒ Object
Creates a domain entry with the specified name.
-
#create_record(domain, name, type, data, options = {}) ⇒ Object
Creates a record with the representation specified in the request content.
-
#create_secondary(secondary_name, ip_addresses) ⇒ Object
Creates a secondary entry with the specified name.
-
#delete_all_domains ⇒ Object
Deletes all domains for your account.
-
#delete_all_secondary ⇒ Object
Deletes all secondary entries for your account.
-
#delete_domain(domain) ⇒ Object
Delete the given domain from your account.
-
#delete_record(domain, record_id) ⇒ Object
Deletes the record with the specified id.
-
#delete_secondary(secondary_name) ⇒ Object
Deletes the specified secondary entry.
-
#get_domain(domain) ⇒ Object
Get the details for a specific domain in your account.
-
#get_record(domain, record_id) ⇒ Object
Returns a record object representing the record with the specified id.
-
#get_secondary(secondary_name) ⇒ Object
Returns the secondary entry object representation of the specified secondary entry.
-
#initialize(options = {}) ⇒ Real
constructor
Initialize connection to DNS Made Easy.
-
#list_domains ⇒ Object
Returns a list of all domain names for your account.
-
#list_records(domain, options = {}) ⇒ Object
Returns a list of record objects containing all records for the specified domain.
-
#list_secondary ⇒ Object
Returns a list of all secondary entry names for your account.
- #reload ⇒ Object
-
#update_record(domain, record_id, options = {}) ⇒ Object
Updates a record with the representation specified in the request content.
-
#update_secondary(secondary_name, ip_addresses) ⇒ Object
Modifies a secondary entry with the specified name.
Constructor Details
#initialize(options = {}) ⇒ Real
Initialize connection to DNS Made Easy
Notes
options parameter must include values for :dnsmadeeasy_api_key and :dnsmadeeasy_secret_key in order to create a connection
Examples
dns = Fog::DNS::DNSMadeEasy.new(
:dnsmadeeasy_api_key => your_dnsmadeeasy_api_key,
:dnsmadeeasy_secret_key => your_dnsmadeeasy_secret_key
)
Parameters
-
options<~Hash> - config arguments for connection. Defaults to {}.
Returns
-
dns object with connection to aws.
81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/fog/dnsmadeeasy/dns.rb', line 81 def initialize(={}) require 'fog/core/parser' @dnsmadeeasy_api_key = [:dnsmadeeasy_api_key] @dnsmadeeasy_secret_key = [:dnsmadeeasy_secret_key] @connection_options = [:connection_options] || {} @host = [:host] || 'api.dnsmadeeasy.com' @persistent = .fetch(:persistent, true) @port = [:port] || 80 #443 Not yet @scheme = [:scheme] || 'http' #'https Not yet @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end |
Instance Method Details
#create_domain(domain) ⇒ Object
Creates a domain entry with the specified name. Returns errors if name is not valid or conflicts with another domain.
Parameters
-
domain<~String> - domain name
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
name<~String> The domain name.
-
nameServer<~Array> List of strings, Name servers associated with this domain e.g. [“ns1.dnsmadeeasy.com”, “ns2.dnsmadeeasy.com”]
-
gtdEnabled<~Boolean> true | false - Indicator of whether or not this domain uses the Global Traffic Director.
-
-
status<~Integer> - 201 - domain successfully created, 400 - domain name not valid, see errors in response content
-
18 19 20 21 22 23 24 |
# File 'lib/fog/dnsmadeeasy/requests/dns/create_domain.rb', line 18 def create_domain(domain) request( :expects => 201, :method => 'PUT', :path => "/V1.2/domains/#{domain}" ) end |
#create_record(domain, name, type, data, options = {}) ⇒ Object
Creates a record with the representation specified in the request content. Returns errors if record is not valid. Note that a record ID will be generated by the system with this request and any ID that is sent will be ignored. Records are not modifiable for domains that are locked to a template.
Parameters
-
domain<~String> Domain name.
-
name<~String> Record name.
-
type<~String> Record type. Values: A, AAAA, CNAME, HTTPRED, MX, NS, PTR, SRV, TXT
-
data<~String> Record data
-
options<~Hash> - optional
-
ttl<~Integer> Time to live. The amount of time a record will be cached before being refreshed. Default: 1800 (30 mins)
-
gtdLocation<~String> Global Traffic Director location. Values: DEFAULT, US_EAST, US_WEST, EUROPE
-
password<~String> For A records. Password used to authenticate for dynamic DNS.
-
description<~String> For HTTPRED records. A description of the HTTPRED record.
-
keywords<~String> For HTTPRED records. Keywords associated with the HTTPRED record.
-
title<~String> For HTTPRED records. The title of the HTTPRED record.
-
redirectType<~String> For HTTPRED records. Type of redirection performed. Values: Hidden Frame Masked, Standard - 302, Standard - 301
-
hardLink<~Boolean> For HTTPRED records.
-
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
id<~Integer> Unique record identifier
-
name<~String>
-
type<~String>
-
data<~String>
-
ttl<~Integer>
-
gtdLocation<~String>
-
password<~String>
-
description<~String>
-
keywords<~String>
-
title<~String>
-
redirectType<~String>
-
hardLink<~Boolean>
-
-
‘status’<~Integer> - 201 - record successfully created, 400 - record not valid, see errors in response content, 404 - domain not found
-
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/fog/dnsmadeeasy/requests/dns/create_record.rb', line 40 def create_record(domain, name, type, data, = {}) body = { "name" => name, "type" => type, "data" => data, "ttl" => 1800 } body.merge!() request( :expects => 201, :method => "POST", :path => "/V1.2/domains/#{domain}/records", :body => Fog::JSON.encode(body) ) end |
#create_secondary(secondary_name, ip_addresses) ⇒ Object
Creates a secondary entry with the specified name. Returns errors if name is not valid or conflicts with another domain.
Parameters
-
secondary_name<~String> - secondary name
-
ip_addresses<~Array> - List of secondary ip addresses
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
name<~String> Secondary name.
-
ip<~Array> List of strings, IP addresses for your master nameserver associated with this secondary entry. e.g. [“10.10.10.10”, “10.10.10.11”]
-
gtdLocation<~String> Global Traffic Director location. Values: DEFAULT, US_EAST, US_WEST, EUROPE
-
-
status<~Integer> - 201 - secondary entry successfully created or modified, 400 - secondary entry name or IP addresses not valid, see errors in response content
-
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/fog/dnsmadeeasy/requests/dns/create_secondary.rb', line 19 def create_secondary(secondary_name, ip_addresses) body = { "ip" => [*ip_addresses] } request( :expects => 201, :method => 'PUT', :path => "/V1.2/secondary/#{secondary_name}", :body => Fog::JSON.encode(body) ) end |
#delete_all_domains ⇒ Object
Deletes all domains for your account.
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
status<~Integer> - 200 - OK
-
12 13 14 15 16 17 18 |
# File 'lib/fog/dnsmadeeasy/requests/dns/delete_all_domains.rb', line 12 def delete_all_domains request( :expects => 200, :method => 'DELETE', :path => '/V1.2/domains' ) end |
#delete_all_secondary ⇒ Object
Deletes all secondary entries for your account.
Returns
-
response<~Excon::Response>:
-
status<~Integer> 200 - OK
-
11 12 13 14 15 16 17 |
# File 'lib/fog/dnsmadeeasy/requests/dns/delete_all_secondary.rb', line 11 def delete_all_secondary request( :expects => 200, :method => 'DELETE', :path => '/V1.2/secondary' ) end |
#delete_domain(domain) ⇒ Object
Delete the given domain from your account.
Parameters
-
domain<~String> - domain name
Returns
-
response<~Excon::Response>:
-
status<~Integer> 200 - OK, 404 - specified domain name is not found
-
14 15 16 17 18 19 20 |
# File 'lib/fog/dnsmadeeasy/requests/dns/delete_domain.rb', line 14 def delete_domain(domain) request( :expects => 200, :method => 'DELETE', :path => "/V1.2/domains/#{domain}" ) end |
#delete_record(domain, record_id) ⇒ Object
Deletes the record with the specified id. Note that records are not modifiable for domains that are locked to a template.
Parameters
-
domain<~String> - domain name
-
record_id<~String> - record id
Returns
-
response<~Excon::Response>:
-
status<~Integer> 200 - OK, 404 - specified domain name or record id is not found
-
15 16 17 18 19 20 21 |
# File 'lib/fog/dnsmadeeasy/requests/dns/delete_record.rb', line 15 def delete_record(domain, record_id) request( :expects => 200, :method => 'DELETE', :path => "/V1.2/domains/#{domain}/records/#{record_id}" ) end |
#delete_secondary(secondary_name) ⇒ Object
Deletes the specified secondary entry.
Parameters
-
secondary_name<~String> - secondary domain name
Returns
-
response<~Excon::Response>:
-
status<~Integer> 200 - OK, 404 - specified secondary entry name is not found
-
14 15 16 17 18 19 20 |
# File 'lib/fog/dnsmadeeasy/requests/dns/delete_secondary.rb', line 14 def delete_secondary(secondary_name) request( :expects => 200, :method => 'DELETE', :path => "/V1.2/secondary/#{secondary_name}" ) end |
#get_domain(domain) ⇒ Object
Get the details for a specific domain in your account.
Parameters
-
domain<~String> - domain name
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
name<~String> The domain name.
-
nameServer<~Array> List of strings, Name servers associated with this domain e.g. [“ns1.dnsmadeeasy.com”, “ns2.dnsmadeeasy.com”]
-
gtdEnabled<~Boolean> Indicator of whether or not this domain uses the Global Traffic Director.
-
-
status<~Integer> 200 - OK, 404 - specified domain name is not found
-
18 19 20 21 22 23 24 |
# File 'lib/fog/dnsmadeeasy/requests/dns/get_domain.rb', line 18 def get_domain(domain) request( :expects => 200, :method => "GET", :path => "/V1.2/domains/#{domain}" ) end |
#get_record(domain, record_id) ⇒ Object
Returns a record object representing the record with the specified id.
Parameters
-
domain<~String>
-
record_id<~Integer>
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
id<~Integer> Unique record identifier
-
name<~String> Record name.
-
type<~String> Record type. Values: A, AAAA, CNAME, HTTPRED, MX, NS, PTR, SRV, TXT
-
data<~String> Record data
-
ttl<~Integer> Time to live. The amount of time a record will be cached before being refreshed. Default: 1800
-
gtdLocation<~String> Global Traffic Director location. Values: DEFAULT, US_EAST, US_WEST, EUROPE
-
password<~String> For A records. Password used to authenticate for dynamic DNS.
-
description<~String> For HTTPRED records. A description of the HTTPRED record.
-
keywords<~String> For HTTPRED records. Keywords associated with the HTTPRED record.
-
title<~String> For HTTPRED records. The title of the HTTPRED record.
-
redirectType<~String> For HTTPRED records. Type of redirection performed. Values: Hidden Frame Masked, Standard - 302, Standard - 301
-
hardLink<~Boolean> For HTTPRED records.
-
-
status<~Integer> - 200 - OK, 404 - specified domain name or record id is not found
-
27 28 29 30 31 32 33 |
# File 'lib/fog/dnsmadeeasy/requests/dns/get_record.rb', line 27 def get_record(domain, record_id) request( :expects => 200, :method => "GET", :path => "/V1.2/domains/#{domain}/records/#{record_id}" ) end |
#get_secondary(secondary_name) ⇒ Object
Returns the secondary entry object representation of the specified secondary entry.
Parameters
-
secondary_name<~String> - secondary name
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
name<~String> Secondary name.
-
ip<~Array> List of strings, IP addresses for your master nameserver associated with this secondary entry. e.g. [“10.10.10.10”, “10.10.10.11”]
-
gtdLocation<~String> Global Traffic Director location. Values: DEFAULT, US_EAST, US_WEST, EUROPE
-
-
status<~Integer> - 200 - OK, 404 - specified secondary entry name is not found
-
18 19 20 21 22 23 24 |
# File 'lib/fog/dnsmadeeasy/requests/dns/get_secondary.rb', line 18 def get_secondary(secondary_name) request( :expects => 200, :method => "GET", :path => "/V1.2/secondary/#{secondary_name}" ) end |
#list_domains ⇒ Object
Returns a list of all domain names for your account.
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
list<~Array> e.g. [“domain1.com”,“domain2.com”, “domain3.com”]
-
-
status<~Integer> - 200 - OK
-
13 14 15 16 17 18 19 |
# File 'lib/fog/dnsmadeeasy/requests/dns/list_domains.rb', line 13 def list_domains request( :expects => 200, :method => 'GET', :path => '/V1.2/domains' ) end |
#list_records(domain, options = {}) ⇒ Object
Returns a list of record objects containing all records for the specified domain
Parameters
-
domain<~String>
-
options<~Hash>
-
gtdLocation<~String> Global Traffic Director location. Values: DEFAULT, US_EAST, US_WEST, EUROPE
-
type<~String> Record type. Values: A, AAAA, CNAME, HTTPRED, MX, NS, PTR, SRV, TXT
-
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
id<~Integer> Unique record identifier
-
name<~String> Record name.
-
type<~String> Record type. Values: A, AAAA, CNAME, HTTPRED, MX, NS, PTR, SRV, TXT
-
data<~String>
-
ttl<~Integer> Time to live. The amount of time a record will be cached before being refreshed.
-
gtdLocation<~String> Global Traffic Director location. Values: DEFAULT, US_EAST, US_WEST, EUROPE
-
password<~String> For A records. Password used to authenticate for dynamic DNS.
-
description<~String> For HTTPRED records. A description of the HTTPRED record.
-
keywords<~String> For HTTPRED records. Keywords associated with the HTTPRED record.
-
title<~String> For HTTPRED records. The title of the HTTPRED record.
-
redirectType<~String> For HTTPRED records. Type of redirection performed. Values: Hidden Frame Masked, Standard - 302, Standard - 301
-
hardLink<~Boolean> For HTTPRED records.
-
-
status<~Integer> - 200 - OK, 404 - specified domain name is not found
-
30 31 32 33 34 35 36 37 |
# File 'lib/fog/dnsmadeeasy/requests/dns/list_records.rb', line 30 def list_records(domain, = {}) request( :expects => 200, :method => "GET", :path => "/V1.2/domains/#{domain}/records", :query => ) end |
#list_secondary ⇒ Object
Returns a list of all secondary entry names for your account.
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
list<~Array> e.g. [“xxx.domain.com”, “xxx.domain.com”]
-
-
status<~Integer> 200 - OK
-
13 14 15 16 17 18 19 |
# File 'lib/fog/dnsmadeeasy/requests/dns/list_secondary.rb', line 13 def list_secondary request( :expects => 200, :method => 'GET', :path => '/V1.2/secondary' ) end |
#reload ⇒ Object
94 95 96 |
# File 'lib/fog/dnsmadeeasy/dns.rb', line 94 def reload @connection.reset end |
#update_record(domain, record_id, options = {}) ⇒ Object
Updates a record with the representation specified in the request content. Returns errors if record is not valid. Note that a record ID will be generated by the system with this request and any ID that is sent will be ignored. Records are not modifiable for domains that are locked to a template.
DNS Made Easy has no update record method but they plan to add it in the next update! They sent a reponse suggesting, there going to internaly delete/create a new record when we make update record call, so I’ve done the same here for now! If want to update a record, it might be better to manually destroy and then create a new record
Parameters
-
domain<~String> Domain name.
-
record_id<~Integer> Record id.
-
options<~Hash>
-
name<~String> Record name.
-
type<~String> Record type. Values: A, AAAA, CNAME, HTTPRED, MX, NS, PTR, SRV, TXT
-
ttl<~Integer> Time to live. The amount of time a record will be cached before being refreshed. Default: 1800 (30 mins)
-
gtdLocation<~String> Global Traffic Director location. Values: DEFAULT, US_EAST, US_WEST, EUROPE
-
password<~String> For A records. Password used to authenticate for dynamic DNS.
-
description<~String> For HTTPRED records. A description of the HTTPRED record.
-
keywords<~String> For HTTPRED records. Keywords associated with the HTTPRED record.
-
title<~String> For HTTPRED records. The title of the HTTPRED record.
-
redirectType<~String> For HTTPRED records. Type of redirection performed. Values: Hidden Frame Masked, Standard - 302, Standard - 301
-
hardLink<~Boolean> For HTTPRED records.
-
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
id<~Integer> Unique record identifier
-
name<~String>
-
type<~String>
-
data<~String>
-
ttl<~Integer>
-
gtdLocation<~String>
-
password<~String>
-
description<~String>
-
keywords<~String>
-
title<~String>
-
redirectType<~String>
-
hardLink<~Boolean>
-
-
‘status’<~Integer> - 201 - record successfully created, 400 - record not valid, see errors in response content, 404 - domain not found
-
44 45 46 47 48 49 50 51 |
# File 'lib/fog/dnsmadeeasy/requests/dns/update_record.rb', line 44 def update_record(domain, record_id, = {}) request( :expects => 200, :method => "PUT", :path => "/V1.2/domains/#{domain}/records/#{record_id}", :body => Fog::JSON.encode() ) end |
#update_secondary(secondary_name, ip_addresses) ⇒ Object
Modifies a secondary entry with the specified name. Returns errors if name is not valid or conflicts with another domain.
Parameters
-
secondary_name<~String> - secondary name
-
ip_addresses<~Array> - List of secondary ip addresses
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
name<~String> Secondary name.
-
ip<~Array> List of strings, IP addresses for your master nameserver associated with this secondary entry. e.g. [“10.10.10.10”, “10.10.10.11”]
-
gtdLocation<~String> Global Traffic Director location. Values: DEFAULT, US_EAST, US_WEST, EUROPE
-
-
status<~Integer> - 201 - secondary entry successfully created or modified, 400 - secondary entry name or IP addresses not valid, see errors in response content
-
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/fog/dnsmadeeasy/requests/dns/update_secondary.rb', line 19 def update_secondary(secondary_name, ip_addresses) body = { "ip" => [*ip_addresses] } request( :expects => 201, :method => 'PUT', :path => "/V1.2/secondary/#{secondary_name}", :body => Fog::JSON.encode(body) ) end |