class Fog::HP::DNS::Real
Create a new DNS domain
Parameters¶ ↑
-
'name'<~String> - Name of the domain
-
'email'<~String> - Email for the domain
-
options<~Hash>:
-
'description'<~String> - Description for the domain
-
'ttl'<~String> - TTL for the domain
-
Returns¶ ↑
-
response<~Excon::Response>:
-
body<~Hash>:
-
'id'<~String> - UUID of the domain
-
'name'<~String> - Name of the domain
-
'description'<~String> - Description for the domain
-
'ttl'<~Integer> - TTL for the domain
-
'email'<~String> - Email for the domain
-
'serial'<~Integer> - Serial number for the domain
-
'created_at'<~String> - created date time stamp
-
-
Get details for existing DNS domain
Parameters¶ ↑
-
domain_id<~String> - UUId of the domain to get
Returns¶ ↑
-
response<~Excon::Response>:
-
body<~Hash>:
-
'id'<~String> - UUID of the domain
-
'name'<~String> - Name of the domain
-
'ttl'<~Integer> - TTL for the domain
-
'email'<~String> - Email for the domain
-
'serial'<~Integer> - Serial number for the domain
-
'created_at'<~String> - created date time stamp
-
-
Attributes
Public Class Methods
# File lib/fog/hp/dns.rb, line 62 def initialize(options={}) @hp_access_key = options[:hp_access_key] @hp_secret_key = options[:hp_secret_key] @hp_auth_uri = options[:hp_auth_uri] @connection_options = options[:connection_options] || {} ### Set an option to use the style of authentication desired; :v1 or :v2 (default) auth_version = options[:hp_auth_version] || :v2 ### Pass the service name for object storage to the authentication call options[:hp_service_type] ||= "DNS" @hp_tenant_id = options[:hp_tenant_id] @hp_avl_zone = options[:hp_avl_zone] ### Make the authentication call if (auth_version == :v2) # Call the control services authentication credentials = Fog::HP.authenticate_v2(options, @connection_options) # the CS service catalog returns the block storage endpoint @hp_block_uri = credentials[:endpoint_url] @credentials = credentials else # Call the legacy v1.0/v1.1 authentication credentials = Fog::HP.authenticate_v1(options, @connection_options) # the user sends in the block storage endpoint @hp_block_uri = options[:hp_auth_uri] end @auth_token = credentials[:auth_token] @persistent = options[:persistent] || false uri = URI.parse(@hp_block_uri) @host = uri.host @path = uri.path @port = uri.port @scheme = uri.scheme @connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options) end
Public Instance Methods
# File lib/fog/hp/requests/dns/create_domain.rb, line 24 def create_domain(name, email, options={}) data = { :name => name, :email => email } l_options = [:description, :ttl] l_options.select{|o| options[o]}.each do |key| data[key] = options[key] end request( :body => Fog::JSON.encode(data), :expects => 200, :method => 'POST', :path => 'domains' ) end
Create a new DNS record
Parameters¶ ↑
-
'domain_id'<~String> - UUId of the domain
-
'name'<~String> - Name of record
-
'type'<~String> - Type of the record i.e. 'A'
-
'data'<~String> - Data required by the record
-
options<~Hash>:
-
'description'<~String> - Description for the record
-
'priority'<~Integer> - Priority
-
'ttl'<~Integer> - TTL of the record
-
Returns¶ ↑
-
response<~Excon::Response>:
-
body<~Hash>:
-
'id'<~String> - UUID of the record
-
'name'<~String> - Name of the record
-
'description'<~String> - Description for the record
-
'type'<~String> - Type of the record
-
'domain_id'<~String> - UUID of the domain
-
'ttl'<~Integer> - TTL of the record
-
'data'<~String> - Data required by the record
-
'priority'<~Integer> - Priority for the record
-
'created_at'<~String> - created date time stamp
-
'updated_at'<~String> - updated date time stamp
-
-
# File lib/fog/hp/requests/dns/create_record.rb, line 30 def create_record(domain_id, name, type, data, options={}) data = { :name => name, :type => type, :data => data } l_options = [:description, :priority, :ttl] l_options.select{|o| options[o]}.each do |key| data[key] = options[key] end request( :body => Fog::JSON.encode(data), :expects => 200, :method => 'POST', :path => "domains/#{domain_id}/records" ) end
Delete a DNS Record
Parameters¶ ↑
-
'domain_id'<~String> - UUId of domain for record
-
'record_id'<~String> - UUId of record to delete
# File lib/fog/hp/requests/dns/delete_record.rb, line 11 def delete_record(domain_id, record_id) request( :expects => 200, :method => 'DELETE', :path => "domains/#{domain_id}/records/#{record_id}" ) end
# File lib/fog/hp/requests/dns/get_domain.rb, line 19 def get_domain(domain_id) request( :expects => 200, :method => 'GET', :path => "domains/#{domain_id}" ) end
Get details of an existing DNS record
Parameters¶ ↑
-
'domain_id'<~String> - UUId of domain for record
-
'record_id'<~String> - UUId of record to get
Returns¶ ↑
-
response<~Excon::Response>:
-
body<~Hash>:
-
'id'<~String> - UUID of the record
-
'name'<~String> - Name of the record
-
'description'<~String> - Description for the record
-
'type'<~String> - Type of the record
-
'domain_id'<~String> - UUId of the domain
-
'ttl'<~Integer> - TTL of the record
-
'data'<~String> - Data required by the record
-
'priority'<~Integer> - Priority for the record
-
'created_at'<~String> - created date time stamp
-
'updated_at'<~String> - updated date time stamp
-
-
# File lib/fog/hp/requests/dns/get_record.rb, line 24 def get_record(domain_id, record_id) request( :expects => 200, :method => 'GET', :path => "domains/#{domain_id}/records/#{record_id}" ) end
Get authoritative nameservers for existing DNS domain
Parameters¶ ↑
-
domain_id<~String> - UUId of the domain to get nameservers for
Returns¶ ↑
-
response<~Excon::Response>:
-
body<~Hash>:
-
'nameservers'<~Array>:
-
'id'<~String> - UUID of the domain
-
'name'<~String> - Name of the domain
-
'ttl'<~Integer> - TTL for the domain
-
'email'<~String> - Email for the domain
-
'serial'<~Integer> - Serial number for the domain
-
'created_at'<~String> - created date time stamp
-
-
-
# File lib/fog/hp/requests/dns/get_servers_hosting_domain.rb, line 20 def get_servers_hosting_domain(domain_id) request( :expects => 200, :method => 'GET', :path => "domains/#{domain_id}/servers" ) end
List all DNS domains
Returns¶ ↑
-
response<~Excon::Response>:
-
body<~Hash>:
-
'domains'<~Array>:
-
'id'<~String> - UUID of the domain
-
'name'<~String> - Name of the domain
-
'ttl'<~Integer> - TTL for the domain
-
'email'<~String> - Email for the domain
-
'serial'<~Integer> - Serial number for the domain
-
'created_at'<~String> - created date time stamp
-
-
-
# File lib/fog/hp/requests/dns/list_domains.rb, line 16 def list_domains request( :expects => 200, :method => 'GET', :path => 'domains' ) end
List DNS records for a given domain
Parameters¶ ↑
-
'domain_id'<~String> - UUId of domain for record
Returns¶ ↑
-
response<~Excon::Response>:
-
body<~Hash>:
-
'records'<~Array>:
-
'id'<~String> - UUID of the record
-
'name'<~String> - Name of the record
-
'description'<~String> - Description for the record
-
'type'<~String> - Type of the record
-
'domain_id'<~String> - UUID of the domain
-
'ttl'<~Integer> - TTL of the record
-
'data'<~String> - Data required by the record
-
'priority'<~Integer> - Priority for the record
-
'created_at'<~String> - created date time stamp
-
'updated_at'<~String> - updated date time stamp
-
-
-
# File lib/fog/hp/requests/dns/list_records_in_a_domain.rb, line 24 def list_records_in_a_domain(domain_id) request( :expects => 200, :method => 'GET', :path => "domains/#{domain_id}/records" ) end
# File lib/fog/hp/dns.rb, line 100 def reload @connection.reset end
# File lib/fog/hp/dns.rb, line 104 def request(params, parse_json = true, &block) begin response = @connection.request(params.merge!({ :headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'X-Auth-Token' => @auth_token }.merge!(params[:headers] || {}), :path => "#{@path}/#{params[:path]}", }), &block) rescue Excon::Errors::HTTPStatusError => error raise case error when Excon::Errors::NotFound Fog::HP::DNS::NotFound.slurp(error) else error end end if !response.body.empty? && parse_json && response.headers['Content-Type'] =~ %r{application/json} response.body = Fog::JSON.decode(response.body) end response end
Update an existing DNS domain
Parameters¶ ↑
-
domain_id<~String> - UUId of domain to delete
-
options<~Hash>:
-
'name'<~String> - Name of domain
-
'description'<~String> - Description for the domain
-
'ttl'<~String> - TTL for the domain
-
'email'<~String> - email for the domain
-
Returns¶ ↑
-
response<~Excon::Response>:
-
body<~Hash>:
-
'id'<~String> - UUID of the domain
-
'name'<~String> - Name of the domain
-
'description'<~String> - Description for the domain
-
'ttl'<~Integer> - TTL for the domain
-
'email'<~String> - Email for the domain
-
'serial'<~Integer> - Serial number for the domain
-
'created_at'<~String> - created date time stamp
-
-
# File lib/fog/hp/requests/dns/update_domain.rb, line 25 def update_domain(domain_id, options={}) data = {} l_options = [:name, :description, :ttl, :email] l_options.select{|o| options[o]}.each do |key| data[key] = options[key] end request( :body => Fog::JSON.encode(data), :expects => 200, :method => 'PUT', :path => "domains/#{domain_id}" ) end
Update an existing DNS record
Parameters¶ ↑
-
'domain_id'<~String> - UUId of domain of record
-
'record_id'<~String> - UUId of record to update
-
options<~Hash>:
-
'name'<~String> - Name of record
-
'description'<~String> - Description for the record
-
'type'<~String> - Type of the record i.e. 'A'
-
'data'<~String> - Data required by the record
-
'priority'<~Integer> - Priority
-
'ttl'<~Integer> - TTL of the record
-
Returns¶ ↑
-
response<~Excon::Response>:
-
body<~Hash>:
-
'id'<~String> - UUID of the record
-
'name'<~String> - Name of the record
-
'description'<~String> - Description for the record
-
'type'<~String> - Type of the record
-
'domain_id'<~String> - UUID of the domain
-
'ttl'<~Integer> - TTL of the record
-
'data'<~String> - Data required by the record
-
'priority'<~Integer> - Priority for the record
-
'created_at'<~String> - created date time stamp
-
'updated_at'<~String> - updated date time stamp
-
-
# File lib/fog/hp/requests/dns/update_record.rb, line 31 def update_record(domain_id, record_id, options={}) data = {} l_options = [:name, :description, :type, :data, :priority, :ttl] l_options.select{|o| options[o]}.each do |key| data[key] = options[key] end request( :body => Fog::JSON.encode(data), :expects => 200, :method => 'PUT', :path => "domains/#{domain_id}/records/#{record_id}" ) end