class Fog::DNS::Rage4::Real
Public Class Methods
# File lib/fog/rage4/dns.rb, line 36 def initialize(options={}) @rage4_email = options[:rage4_email] @rage4_password = options[:rage4_api_key] @connection_options = options[:connection_options] || {} if options[:rage4_url] uri = URI.parse(options[:rage4_url]) options[:host] = uri.host options[:port] = uri.port options[:scheme] = uri.scheme end @host = options[:host] || "secure.rage4.com" @persistent = options[:persistent] || false @port = options[:port] || 443 @scheme = options[:scheme] || 'https' @connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end
Public Instance Methods
secure.rage4.com//rapi/SetRecordState/
# File lib/fog/rage4/requests/dns/bulk_update_records.rb, line 21 def bulk_update_records(zone_id, options = {}) path = "/rapi/SetRecordState/#{zone_id}" body = options[:body] if options[:body].present? request( :expects => 200, :method => 'POST', :body => body, :path => path, :headers => { 'Content-Type' => "application/json; charset=UTF-8", }, ) end
Create a domain.
Parameters¶ ↑
-
name<~String> - domain name
-
email<~String> - email of owner of domain, defaults to email of credentials
Returns¶ ↑
-
response<~Excon::Response>:
-
body<~Hash>:
* 'status'<~Boolean> * 'id'<~Integer> * 'error'<~String>
-
# File lib/fog/rage4/requests/dns/create_domain.rb, line 18 def create_domain(name, options = {}) email = options[:email] || @rage4_email request( :expects => 200, :method => 'GET', :path => "/rapi/createregulardomain/?name=#{name}&email=#{email}" ) end
Create a domain with a vanity name server.
Parameters¶ ↑
-
name<~String> - domain name
-
nsname<~String> - vanity ns domain name
-
nsprefix<~String> - prefix for the domain name, defaults to 'ns'
Returns¶ ↑
-
response<~Excon::Response>:
-
body<~Hash>:
* 'status'<~Boolean> * 'id'<~Integer> * 'error'<~String>
-
# File lib/fog/rage4/requests/dns/create_domain_vanity.rb, line 17 def create_domain_vanity(name, nsname, options = {}) email = options[:email] || @rage4_email nsprefix = options[:nsprefix] || 'ns' request( :expects => 200, :method => 'GET', :path => "/rapi/createregulardomainext/?name=#{name}&email=#{email}" + "&nsname=#{nsname}&nsprefix=#{nsprefix}" ) end
secure.rage4.com/rapi/createrecord/
# File lib/fog/rage4/requests/dns/create_record.rb, line 30 def create_record(domain_id, name, content, type, options = {}) path = "/rapi/createrecord/#{domain_id}" path << "?name=#{name}&content=#{content}&type=#{type}" path << "&priority=#{options[:priority]}" if options[:priority] failover = options[:failover] || 'false' path << "&failover=#{failover}" path << "&failovercontent=#{options[:failovercontent]}" if options[:failovercontent] ttl = options[:ttl] || 3600 path << "&ttl=#{ttl}" path << "&geozone=#{options[:geozone]}" if options[:geozone] path << "&geolock=#{options[:geolock]}" if options[:geolock] path << "&geolat=#{options[:geolat]}" if options[:geolat] path << "&geolong=#{options[:geolong]}" if options[:geolong] path << "&udplimit=#{options[:udplimit]}" if options[:udplimit] request( :expects => 200, :method => 'GET', :path => path ) end
Create a reverse domain for an ipv4 address .
Parameters¶ ↑
-
name<~String> - expects an ipv5 address
-
subnet<~Integer> - subnet ie: 9 for /9, range is /8 to /30
Returns¶ ↑
-
response<~Excon::Response>:
-
body<~Hash>:
* 'status'<~Boolean> * 'id'<~Integer> * 'error'<~String>
-
# File lib/fog/rage4/requests/dns/create_reverse_domain_4.rb, line 16 def create_reverse_domain_4(name, subnet, options = {}) email = options[:email] || @rage4_email request( :expects => 200, :method => 'GET', :path => "/rapi/createreversedomain4/?name=#{name}&email=#{email}" + "&subnet=#{subnet}" ) end
Delete a specific domain
Parameters¶ ↑
-
id<~Integer> - numeric ID
Returns¶ ↑
-
response<~Excon::Response>:
-
body<~Hash>:
* 'status'<~Boolean> * 'id'<~Integer> * 'error'<~String>
-
# File lib/fog/rage4/requests/dns/delete_domain.rb, line 15 def delete_domain(id) request( :expects => 200, :method => 'GET', :path => "/rapi/deletedomain/#{id}" ) end
Delete a specific record
Parameters¶ ↑
-
id<~Integer> - numeric record ID
Returns¶ ↑
-
response<~Excon::Response>:
-
body<~Hash>:
* 'status'<~Boolean> * 'id'<~Integer> * 'error'<~String>
-
# File lib/fog/rage4/requests/dns/delete_record.rb, line 15 def delete_record(id) request( :expects => 200, :method => 'GET', :path => "/rapi/deleterecord/#{id}" ) end
Get the details for a specific domain in your account.
Parameters¶ ↑
-
id<~Integer> - numeric ID
Returns¶ ↑
-
response<~Excon::Response>:
-
body<~Hash>:
* 'id'<~Integer> * 'name'<~String> * 'owner_email'<~String> * 'type'<~Integer> * 'subnet_mask'<~Integer>
-
# File lib/fog/rage4/requests/dns/get_domain.rb, line 17 def get_domain(id) request( :expects => 200, :method => 'GET', :path => "/rapi/getdomain/#{id}" ) end
Get the details for a specific domain in your account.
Parameters¶ ↑
-
name<~String> - name of domain
Returns¶ ↑
-
response<~Excon::Response>:
-
body<~Hash>:
* 'id'<~Integer> * 'name'<~String> * 'owner_email'<~String> * 'type'<~Integer> * 'subnet_mask'<~Integer>
-
# File lib/fog/rage4/requests/dns/get_domain_by_name.rb, line 17 def get_domain_by_name(name) request( :expects => 200, :method => 'GET', :path => "/rapi/getdomainbyname/?name=#{name}") end
Get the lsit of all domains for your account.
Parameters¶ ↑
Returns¶ ↑
-
response<~Excon::Response>:
-
body<~Array>:
-
'domains'<~Hash>
-
'id'<~Integer>
-
'name'<~String>
-
'owner_email'<~String>
-
'type'<~Integer>
-
'subnet_mask'<~Integer>
-
-
-
# File lib/fog/rage4/requests/dns/list_domains.rb, line 17 def list_domains request( :expects => 200, :method => 'GET', :path => '/rapi/getdomains' ) end
List all the geo regions available
Parameters¶ ↑
Returns¶ ↑
-
response<~Excon::Response>:
-
body<~Array>:
-
'record types'<~Hash> *'name' <~String> geo record name *'value' <~Integer> Integer value of the type
-
-
# File lib/fog/rage4/requests/dns/list_geo_regions.rb, line 15 def list_geo_regions request( :expects => 200, :method => 'GET', :path => '/rapi/listgeoregions' ) end
List all the record types available
Parameters¶ ↑
Returns¶ ↑
-
response<~Excon::Response>:
-
body<~Array>:
-
'record types'<~Hash> *'name' <~String> record type name *'value' <~Integer> Integer value of the type
-
-
# File lib/fog/rage4/requests/dns/list_record_types.rb, line 14 def list_record_types request( :expects => 200, :method => 'GET', :path => '/rapi/listrecordtypes' ) end
Get the list of records for the specific domain.
Parameters¶ ↑
-
id<~Integer>
Returns¶ ↑
-
response<~Excon::Response>:
-
records<Array~>
-
name<~String>
-
ttl<~Integer>
-
updated_at<~String>
-
domain_id<~Integer>
-
id<~Integer>
-
content<~String>
-
record_type<~String>
-
priority<~Integer>
-
-
# File lib/fog/rage4/requests/dns/list_records.rb, line 20 def list_records(id) request( :expects => 200, :method => "GET", :path => "/rapi/getrecords/#{id}" ) end
# File lib/fog/rage4/dns.rb, line 53 def reload @connection.reset end
# File lib/fog/rage4/dns.rb, line 57 def request(params) params[:headers] ||= {} key = "#{@rage4_email}:#{@rage4_password}" params[:headers].merge!({ "Authorization" => "Basic " + Base64.encode64(key).gsub("\n",'')}) response = @connection.request(params) unless response.body.empty? response.body = Fog::JSON.decode(response.body) end response end
Set a failover to on or off
Parameters¶ ↑
-
id<~Integer> - numeric ID
Returns¶ ↑
-
response<~Excon::Response>:
-
body<~Hash>:
* 'status'<~Boolean> * 'id'<~Integer> * 'error'<~String>
-
# File lib/fog/rage4/requests/dns/set_record_failover.rb, line 15 def set_record_failover(id, active, failover) request( :expects => 200, :method => 'GET', :path => "/rapi/setrecordfailover/#{id}&active=#{active}&failover=#{failover}" ) end
Shows current usage for a single domain
Parameters¶ ↑
-
id<~Integer> - domain name numeric ID
Returns¶ ↑
-
response<~Excon::Response>:
-
body<~Array>
-
# File lib/fog/rage4/requests/dns/show_current_usage.rb, line 12 def show_current_usage(id) request( :expects => 200, :method => 'GET', :path => "/rapi/showcurrentusage/#{id}" ) end
Update an existing domain
Parameters¶ ↑
-
id<~Integer> - domain integer value
-
email <~String> - email of domain owner
-
nsprefix<~String> - vanity ns prefix (nullable)
-
nsname<~String> - vanity ns domain name (nullable)
-
enablevanity<~String> - activate/deactivate
-
failover<~Boolean> - failover enable
Returns¶ ↑
-
response<~Excon::Response>:
-
body<~Hash>:
* 'status'<~Boolean> * 'id'<~Integer> * 'error'<~String>
-
# File lib/fog/rage4/requests/dns/update_domain.rb, line 20 def update_domain(id, options = {}) email = options[:email] || @rage4_email path = "/rapi/updatedomain/#{id}?email=#{email}" path << "&nsname=#{options[:nsname]}" if options[:nsname] path << "&nsprefix=#{options[:nsprefix]}" if options[:nsprefix] path << "&enablevanity=#{options[:enablevanity]}" if options[:enablevanity] path << "&failover=#{options[:failover]}" if options[:failover] request( :expects => 200, :method => 'GET', :path => path ) end
secure.rage4.com/rapi/createrecord/
# File lib/fog/rage4/requests/dns/update_record.rb, line 30 def update_record(record_id, name, content, type, options = {}) path = "/rapi/updaterecord/#{record_id}" path << "?name=#{name}&content=#{content}&type=#{type}" path << "&priority=#{options[:priority]}" if options[:priority] failover = options[:failover] || 'false' path << "&failover=#{failover}" path << "&failovercontent=#{options[:failovercontent]}" if options[:failovercontent] ttl = options[:ttl] || 3600 path << "&ttl=#{ttl}" path << "&geozone=#{options[:geozone]}" if options[:geozone] path << "&geolock=#{options[:geolock]}" if options[:geolock] path << "&geolat=#{options[:geolat]}" if options[:geolat] path << "&geolong=#{options[:geolong]}" if options[:geolong] path << "&udplimit=#{options[:udplimit]}" if options[:udplimit] request( :expects => 200, :method => 'GET', :path => path ) end