# File lib/fog/linode/dns.rb, line 55 def initialize(options={}) @connection_options = options[:connection_options] || {} @host = options[:host] || "api.linode.com" @linode_api_key = options[:linode_api_key] @persistent = options[:persistent] || false @port = options[:port] || 443 @scheme = options[:scheme] || 'https' @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end
Creates a domain record
domain<~String>: The zone's name. Note, if master zone, SOA_email is required and if slave
master_ips is/are required
type<~String>: master or slave
options<~Hash>
description<~String> Currently undisplayed
SOA_email<~String> Required when type=master
refresh_sec<~Integer> numeric, default: '0'
retry_sec<~Integer> numeric, default: '0'
expire_sec<~Integer> numeric, default: '0'
ttl_sec<~String> numeric, default: '0'
status<~Integer> 0, 1, or 2 (disabled, active, edit mode), default: 1
master_ips<~String> When type=slave, the zone's master DNS servers list, semicolon separated
response<~Excon::Response>:
body<~Hash>:
DATA<~Hash>:
'DomainID'<~Integer>: domain ID
# File lib/fog/linode/requests/dns/domain_create.rb, line 27 def domain_create(domain, type, options = {}) query= {} request( :expects => 200, :method => 'GET', :query => { :api_action => 'domain.create', :domain => domain, :type => type }.merge!( options) ) end
Delete the given domain from the list Linode hosts
domain_id<~Integer>: id of domain to delete
response<~Excon::Response>:
body<~Hash>:
DATA<~Hash>:
TODO: docs
# File lib/fog/linode/requests/dns/domain_delete.rb, line 16 def domain_delete(domain_id) request( :expects => 200, :method => 'GET', :query => { :api_action => 'domain.delete', :domainId => domain_id } ) end
List of domains (you have access to)
domain_id<~Integer>: limit the list to the domain ID specified
response<~Excon::Response>:
body<~Array>:
DATA<~Array>
'DOMAINID'<~Interger>
'SOA_EMAIL'<~String>
'DESCRIPTION'<~String>
'TTL_SEC'<~String>
'EXPIRE_SEC'<~Integer>
'RETRY_SEC'<~Integer>
'DOMAIN'<~String>
'STATUS'<~Integer>
'MASTER_IPS'<~String>
'REFRESH_SEC'<~Integer>
'TYPE'<~String>
# File lib/fog/linode/requests/dns/domain_list.rb, line 26 def domain_list(domain_id = nil) options = {} if domain_id options.merge!(:domainId => domain_id) end request( :expects => 200, :method => 'GET', :query => { :api_action => 'domain.list' }.merge!(options) ) end
Creates a resource record in a domain
domain_id<~Integer>: limit the list to the domain ID specified
type<~String>: One of: NS, MX, A, AAAA, CNAME, TXT, or SRV
options<~Hash>
name<~String>: The hostname or FQDN. When Type=MX the subdomain to delegate to the
Target MX server
target<~String> When Type=MX the hostname. When Type=CNAME the target of the alias.
When Type=TXT the value of the record. When Type=A or AAAA the token of '[remote_addr]' will be substituted with the IP address of the request.
priority<~Integer>: priority for MX and SRV records, 0-255 - default: 10
weight<~Integer>: default: 5
port<~Integer>: default: 80
protocol<~String>: The protocol to append to an SRV record. Ignored on other record
types. default: udp
ttl_sec<~Integer>: note, Linode will round the input to set values (300, 3600, 7200, etc)
response<~Excon::Response>:
body<~Hash>:
DATA<~Hash>:
'ResourceID'<~Integer>: ID of the resource record created
# File lib/fog/linode/requests/dns/domain_resource_create.rb, line 28 def domain_resource_create(domain_id, type, options = {}) query= {} request( :expects => 200, :method => 'GET', :query => { :api_action => 'domain.resource.create', :domainID => domain_id, :type => type }.merge!( options) ) end
Delete the given resource from a domain
domain_id<~Integer>: id of domain resource belongs to
resource_id<~Integer>: id of resouce to delete
response<~Excon::Response>:
body<~Hash>:
DATA<~Hash>:
resource_id<~Integer>: resource id that was deleted
# File lib/fog/linode/requests/dns/domain_resource_delete.rb, line 17 def domain_resource_delete(domain_id, resource_id) request( :expects => 200, :method => 'GET', :query => { :api_action => 'domain.resource.delete', :domainId => domain_id, :resourceID => resource_id } ) end
List of resource records for a domain
domain_id<~Integer>: limit the list to the domain ID specified
resource_id<~Integer>: optional. use if want only a specific resource record
response<~Excon::Response>:
body<~Array>:
DATA<~Array>
'PROTOCOL'<~String>: for SRV records. default is UDP
'TTL_SEC'<~Interger>:
'PRIORITY'<~Interger>: for MX and SRV records
'TYPE'<~String>: One of: NS, MX, A, AAAA, CNAME, TXT, or SRV
'TARGET'<~String>: When Type=MX the hostname. When Type=CNAME the target of the alias.
When Type=TXT the value of the record. When Type=A or AAAA the token of '[remote_addr]' will be substituted with the IP address of the request.
'WEIGHT'<~Interger>:
'RESOURCEID'<~Interger>: ID of the resource record
'PORT'<~Interger>:
'DOMAINID'<~Interger>: ID of the domain that this record belongs to
'NAME'<~Interger>: The hostname or FQDN. When Type=MX, the subdomain to delegate to
# File lib/fog/linode/requests/dns/domain_resource_list.rb, line 28 def domain_resource_list(domain_id, resource_id = nil) query = { :api_action => 'domain.resource.list', :domainID => domain_id } if resource_id query[:resourceID] = resource_id end request( :expects => 200, :method => 'GET', :query => query ) end
Updates a resource record in a domain
domain_id<~Integer>: limit the list to the domain ID specified
resource_id<~Integer>: id of resouce to delete
options<~Hash>
type<~String>: One of: NS, MX, A, AAAA, CNAME, TXT, or SRV
name<~String>: The hostname or FQDN. When Type=MX the subdomain to delegate to the
Target MX server
target<~String> When Type=MX the hostname. When Type=CNAME the target of the alias.
When Type=TXT the value of the record. When Type=A or AAAA the token of '[remote_addr]' will be substituted with the IP address of the request.
priority<~Integer>: priority for MX and SRV records, 0-255 - default: 10
weight<~Integer>: default: 5
port<~Integer>: default: 80
protocol<~String>: The protocol to append to an SRV record. Ignored on other record
types. default: udp
ttl_sec<~Integer>: note, Linode will round the input to set values (300, 3600, 7200, etc)
response<~Excon::Response>:
body<~Hash>:
DATA<~Hash>:
'ResourceID'<~Integer>: ID of the resource record updated
# File lib/fog/linode/requests/dns/domain_resource_update.rb, line 29 def domain_resource_update(domain_id, resource_id, options = {}) query= {} request( :expects => 200, :method => 'GET', :query => { :api_action => 'domain.resource.update', :domainID => domain_id, :resourceID => resource_id, }.merge!( options) ) end
Update a domain record
domain_id<~Integer>: The ID to identify the zone
options<~Hash>
domain<~String>: The zone's name.
type<~String>: master or slave
description<~String> Currently undisplayed
SOA_email<~String> Required when type=master
refresh_sec<~Integer> numeric, default: '0'
retry_sec<~Integer> numeric, default: '0'
expire_sec<~Integer> numeric, default: '0'
ttl_sec<~String> numeric, default: '0'
status<~Integer> 0, 1, or 2 (disabled, active, edit mode), default: 1
master_ips<~String> When type=slave, the zone's master DNS servers list, semicolon separated
response<~Excon::Response>:
body<~Hash>:
DATA<~Hash>:
'DomainID'<~Integer>: domain ID
# File lib/fog/linode/requests/dns/domain_update.rb, line 27 def domain_update(domain_id, options = {}) request( :expects => 200, :method => 'GET', :query => { :api_action => 'domain.update', :domainId => domain_id }.merge!(options) ) end
# File lib/fog/linode/dns.rb, line 65 def reload @connection.reset end
# File lib/fog/linode/dns.rb, line 69 def request(params) params[:query] ||= {} params[:query].merge!(:api_key => @linode_api_key) response = @connection.request(params.merge!({:host => @host})) unless response.body.empty? response.body = Fog::JSON.decode(response.body) if data = response.body['ERRORARRAY'].first error = case data['ERRORCODE'] when 5 Fog::DNS::Linode::NotFound else Fog::DNS::Linode::Error end raise error.new(data['ERRORMESSAGE']) end end response end
Generated with the Darkfish Rdoc Generator 2.