class Fog::DNS::DNSMadeEasy::Real
Public Class Methods
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.
# File lib/fog/dnsmadeeasy/dns.rb, line 78 def initialize(options={}) @dnsmadeeasy_api_key = options[:dnsmadeeasy_api_key] @dnsmadeeasy_secret_key = options[:dnsmadeeasy_secret_key] @connection_options = options[:connection_options] || {} @host = options[:host] || 'api.dnsmadeeasy.com' @persistent = options.fetch(:persistent, true) @port = options[:port] || 80 #443 Not yet @scheme = options[:scheme] || 'http' #'https Not yet @connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end
Public Instance Methods
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
-
# File lib/fog/dnsmadeeasy/requests/dns/create_domain.rb, line 17 def create_domain(domain) request( :expects => 201, :method => 'PUT', :path => "/V1.2/domains/#{domain}" ) end
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
-
# File lib/fog/dnsmadeeasy/requests/dns/create_record.rb, line 39 def create_record(domain, name, type, data, options = {}) body = { "name" => name, "type" => type, "data" => data, "ttl" => 1800 } body.merge!(options) request( :expects => 201, :method => "POST", :path => "/V1.2/domains/#{domain}/records", :body => Fog::JSON.encode(body) ) end
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
-
# File lib/fog/dnsmadeeasy/requests/dns/create_secondary.rb, line 18 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 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
-
# File lib/fog/dnsmadeeasy/requests/dns/delete_domain.rb, line 13 def delete_domain(domain) request( :expects => 200, :method => 'DELETE', :path => "/V1.2/domains/#{domain}" ) end
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
-
# File lib/fog/dnsmadeeasy/requests/dns/delete_record.rb, line 14 def delete_record(domain, record_id) request( :expects => 200, :method => 'DELETE', :path => "/V1.2/domains/#{domain}/records/#{record_id}" ) end
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
-
# File lib/fog/dnsmadeeasy/requests/dns/delete_secondary.rb, line 13 def delete_secondary(secondary_name) request( :expects => 200, :method => 'DELETE', :path => "/V1.2/secondary/#{secondary_name}" ) end
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
-
# File lib/fog/dnsmadeeasy/requests/dns/get_domain.rb, line 17 def get_domain(domain) request( :expects => 200, :method => "GET", :path => "/V1.2/domains/#{domain}" ) end
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
-
# File lib/fog/dnsmadeeasy/requests/dns/get_record.rb, line 26 def get_record(domain, record_id) request( :expects => 200, :method => "GET", :path => "/V1.2/domains/#{domain}/records/#{record_id}" ) end
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
-
# File lib/fog/dnsmadeeasy/requests/dns/get_secondary.rb, line 17 def get_secondary(secondary_name) request( :expects => 200, :method => "GET", :path => "/V1.2/secondary/#{secondary_name}" ) end
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
-
# File lib/fog/dnsmadeeasy/requests/dns/list_domains.rb, line 12 def list_domains request( :expects => 200, :method => 'GET', :path => '/V1.2/domains' ) end
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
-
# File lib/fog/dnsmadeeasy/requests/dns/list_records.rb, line 29 def list_records(domain, options = {}) request( :expects => 200, :method => "GET", :path => "/V1.2/domains/#{domain}/records", :query => options ) end
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
-
# File lib/fog/dnsmadeeasy/requests/dns/list_secondary.rb, line 12 def list_secondary request( :expects => 200, :method => 'GET', :path => '/V1.2/secondary' ) end
# File lib/fog/dnsmadeeasy/dns.rb, line 90 def reload @connection.reset end
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
-
# File lib/fog/dnsmadeeasy/requests/dns/update_record.rb, line 43 def update_record(domain, record_id, options = {}) request( :expects => 200, :method => "PUT", :path => "/V1.2/domains/#{domain}/records/#{record_id}", :body => Fog::JSON.encode(options) ) end
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
-
# File lib/fog/dnsmadeeasy/requests/dns/update_secondary.rb, line 18 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
Private Instance Methods
# File lib/fog/dnsmadeeasy/dns.rb, line 96 def request(params) params[:headers] ||= {} params[:headers]['x-dnsme-apiKey'] = @dnsmadeeasy_api_key params[:headers]['x-dnsme-requestDate'] = Fog::Time.now.to_date_header params[:headers]['x-dnsme-hmac'] = signature(params) params[:headers]['Accept'] = 'application/json' params[:headers]['Content-Type'] = 'application/json' begin response = @connection.request(params) rescue Excon::Errors::HTTPStatusError => error raise case error when Excon::Errors::NotFound Fog::DNS::DNSMadeEasy::NotFound.slurp(error) else error end end unless response.body.empty? response.body = Fog::JSON.decode(response.body) end response end
# File lib/fog/dnsmadeeasy/dns.rb, line 123 def signature(params) string_to_sign = params[:headers]['x-dnsme-requestDate'] OpenSSL::HMAC.hexdigest('sha1', @dnsmadeeasy_secret_key, string_to_sign) end