Class: Fog::DNS::Softlayer::Real
- Inherits:
-
Object
- Object
- Fog::DNS::Softlayer::Real
show all
- Includes:
- Softlayer::Compute::Shared
- Defined in:
- lib/fog/softlayer/dns.rb,
lib/fog/softlayer/requests/dns/get_domain.rb,
lib/fog/softlayer/requests/dns/get_record.rb,
lib/fog/softlayer/requests/dns/get_domains.rb,
lib/fog/softlayer/requests/dns/get_records.rb,
lib/fog/softlayer/requests/dns/create_domain.rb,
lib/fog/softlayer/requests/dns/create_record.rb,
lib/fog/softlayer/requests/dns/delete_domain.rb,
lib/fog/softlayer/requests/dns/delete_record.rb,
lib/fog/softlayer/requests/dns/update_record.rb,
lib/fog/softlayer/requests/dns/get_domain_by_name.rb
Overview
Makes real connections to Softlayer.
Instance Attribute Summary collapse
Instance Method Summary
collapse
#initialize, valid_request?
Instance Attribute Details
#default_domain ⇒ Object
Returns the value of attribute default_domain.
60
61
62
|
# File 'lib/fog/softlayer/dns.rb', line 60
def default_domain
@default_domain
end
|
Instance Method Details
#create_domain(opts) ⇒ Object
73
74
75
|
# File 'lib/fog/softlayer/requests/dns/create_domain.rb', line 73
def create_domain(opts)
request(:dns_domain, :create_object, :body => opts, :http_method => :POST)
end
|
#create_record(opts) ⇒ Object
43
44
45
|
# File 'lib/fog/softlayer/requests/dns/create_record.rb', line 43
def create_record(opts)
request(:dns_domain_resourceRecord, :create_object, :body => opts, :http_method => :POST)
end
|
#delete_domain(id) ⇒ Object
28
29
30
|
# File 'lib/fog/softlayer/requests/dns/delete_domain.rb', line 28
def delete_domain(id)
request(:dns_domain, id.to_s, :http_method => :DELETE)
end
|
#delete_record(id) ⇒ Object
32
33
34
|
# File 'lib/fog/softlayer/requests/dns/delete_record.rb', line 32
def delete_record(id)
request(:dns_domain_resourceRecord, id.to_s, :http_method => :DELETE)
end
|
#get_domain(id) ⇒ Object
27
28
29
|
# File 'lib/fog/softlayer/requests/dns/get_domain.rb', line 27
def get_domain(id)
request(:dns_domain, id)
end
|
#get_domain_by_name(name) ⇒ Object
30
31
32
|
# File 'lib/fog/softlayer/requests/dns/get_domain_by_name.rb', line 30
def get_domain_by_name(name)
request(:dns_domain, "getByDomainName/" + URI::encode(name.to_s, "-"))
end
|
#get_domains ⇒ Object
22
23
24
|
# File 'lib/fog/softlayer/requests/dns/get_domains.rb', line 22
def get_domains
request(:account, :get_domains)
end
|
#get_record(id) ⇒ Object
31
32
33
|
# File 'lib/fog/softlayer/requests/dns/get_record.rb', line 31
def get_record(id)
request(:dns_domain_resourceRecord, id)
end
|
#get_records(domain_id) ⇒ Object
27
28
29
|
# File 'lib/fog/softlayer/requests/dns/get_records.rb', line 27
def get_records(domain_id)
request(:dns_domain, domain_id.to_s + '/getResourceRecords')
end
|
#request(service, path, options = {}) ⇒ Excon::Response
Sends the real request to the real SoftLayer service.
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
# File 'lib/fog/softlayer/dns.rb', line 79
def request(service, path, options={})
http_method = options[:http_method] || :get
@request_url = options[:softlayer_api_url] || Fog::Softlayer::SL_API_URL
credentialize_url(@credentials[:username], @credentials[:api_key])
set_sl_service(service)
set_sl_path(path)
params = { :headers => }
params[:headers]['Content-Type'] = 'application/json'
params[:expects] = options[:expected] || [200,201]
params[:body] = Fog::JSON.encode({:parameters => [ options[:body] ]}) unless options[:body].nil?
params[:query] = options[:query] unless options[:query].nil?
@connection = Fog::Core::Connection.new(@request_url, false, params)
response = @connection.request(:method => http_method)
response.body = Fog::JSON.decode(response.body)
response
end
|
#update_record(record_id, opts) ⇒ Object
43
44
45
|
# File 'lib/fog/softlayer/requests/dns/update_record.rb', line 43
def update_record(record_id, opts)
request(:dns_domain_resourceRecord, record_id, :body => opts, :http_method => :PUT)
end
|