Class: Fog::DNS::OpenStack::V2::Real
- Inherits:
-
Object
- Object
- Fog::DNS::OpenStack::V2::Real
show all
- Includes:
- OpenStack::Core
- Defined in:
- lib/fog/dns/openstack/v2.rb,
lib/fog/dns/openstack/v2/requests/get_zone.rb,
lib/fog/dns/openstack/v2/requests/get_quota.rb,
lib/fog/dns/openstack/v2/requests/list_zones.rb,
lib/fog/dns/openstack/v2/requests/create_zone.rb,
lib/fog/dns/openstack/v2/requests/delete_zone.rb,
lib/fog/dns/openstack/v2/requests/update_zone.rb,
lib/fog/dns/openstack/v2/requests/update_quota.rb,
lib/fog/dns/openstack/v2/requests/get_recordset.rb,
lib/fog/dns/openstack/v2/requests/list_recordsets.rb,
lib/fog/dns/openstack/v2/requests/create_recordset.rb,
lib/fog/dns/openstack/v2/requests/delete_recordset.rb,
lib/fog/dns/openstack/v2/requests/update_recordset.rb
Instance Attribute Summary
#auth_token, #auth_token_expiration, #current_tenant, #current_user, #current_user_id, #openstack_cache_ttl, #openstack_domain_id, #openstack_domain_name, #openstack_identity_prefix, #openstack_project_domain, #openstack_project_domain_id, #openstack_project_id, #openstack_user_domain, #openstack_user_domain_id, #unscoped_token
Class Method Summary
collapse
Instance Method Summary
collapse
-
#create_recordset(zone_id, name, type, records, options = {}) ⇒ Object
-
#create_zone(name, email, options = {}) ⇒ Object
-
#delete_recordset(zone_id, id, options = {}) ⇒ Object
-
#delete_zone(id, options = {}) ⇒ Object
-
#get_quota(project_id = nil) ⇒ Object
-
#get_recordset(zone_id, id, options = {}) ⇒ Object
-
#get_zone(id, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Real
constructor
-
#list_recordsets(zone_id = nil, options = {}) ⇒ Object
-
#list_zones(options = {}) ⇒ Object
-
#set_api_path ⇒ Object
-
#update_quota(project_id, options = {}) ⇒ Object
-
#update_recordset(zone_id, id, options = {}) ⇒ Object
-
#update_zone(id, options = {}) ⇒ Object
#credentials, #initialize_identity, #reload
Constructor Details
#initialize(options = {}) ⇒ Real
Returns a new instance of Real.
178
179
180
181
182
183
184
185
186
187
188
189
190
|
# File 'lib/fog/dns/openstack/v2.rb', line 178
def initialize(options = {})
initialize_identity options
@openstack_service_type = options[:openstack_service_type] || ['dns']
@openstack_service_name = options[:openstack_service_name]
@connection_options = options[:connection_options] || {}
authenticate
set_api_path
@persistent = options[:persistent] || false
@connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}/", @persistent, @connection_options)
end
|
Class Method Details
.not_found_class ⇒ Object
174
175
176
|
# File 'lib/fog/dns/openstack/v2.rb', line 174
def self.not_found_class
Fog::DNS::OpenStack::NotFound
end
|
Instance Method Details
#create_recordset(zone_id, name, type, records, options = {}) ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/fog/dns/openstack/v2/requests/create_recordset.rb', line 6
def create_recordset(zone_id, name, type, records, options = {})
data = {
'name' => name,
'type' => type,
'records' => records
}
vanilla_options = [:ttl, :description]
vanilla_options.select { |o| options[o] }.each do |key|
data[key] = options[key]
end
request(
:body => Fog::JSON.encode(data),
:expects => 202,
:method => 'POST',
:path => "zones/#{zone_id}/recordsets"
)
end
|
#create_zone(name, email, options = {}) ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/fog/dns/openstack/v2/requests/create_zone.rb', line 6
def create_zone(name, email, options = {})
data = {
'name' => name,
'email' => email
}
vanilla_options = [:ttl, :description, :type, :masters]
vanilla_options.select { |o| options[o] }.each do |key|
data[key] = options[key]
end
request(
:body => Fog::JSON.encode(data),
:expects => 202,
:method => 'POST',
:path => "zones"
)
end
|
#delete_recordset(zone_id, id, options = {}) ⇒ Object
6
7
8
9
10
11
12
13
14
|
# File 'lib/fog/dns/openstack/v2/requests/delete_recordset.rb', line 6
def delete_recordset(zone_id, id, options = {})
, _options = Fog::DNS::OpenStack::V2.(options)
request(
:expects => 202,
:method => 'DELETE',
:path => "zones/#{zone_id}/recordsets/#{id}",
:headers =>
)
end
|
#delete_zone(id, options = {}) ⇒ Object
6
7
8
9
10
11
12
13
14
|
# File 'lib/fog/dns/openstack/v2/requests/delete_zone.rb', line 6
def delete_zone(id, options = {})
, _options = Fog::DNS::OpenStack::V2.(options)
request(
:expects => 202,
:method => 'DELETE',
:path => "zones/#{id}",
:headers =>
)
end
|
#get_quota(project_id = nil) ⇒ Object
6
7
8
9
10
11
12
13
14
15
|
# File 'lib/fog/dns/openstack/v2/requests/get_quota.rb', line 6
def get_quota(project_id = nil)
, _options = Fog::DNS::OpenStack::V2.(:all_projects => !project_id.nil?)
request(
:expects => 200,
:method => 'GET',
:path => "quotas/#{project_id}",
:headers =>
)
end
|
#get_recordset(zone_id, id, options = {}) ⇒ Object
6
7
8
9
10
11
12
13
14
|
# File 'lib/fog/dns/openstack/v2/requests/get_recordset.rb', line 6
def get_recordset(zone_id, id, options = {})
, _options = Fog::DNS::OpenStack::V2.(options)
request(
:expects => 200,
:method => 'GET',
:path => "zones/#{zone_id}/recordsets/#{id}",
:headers =>
)
end
|
#get_zone(id, options = {}) ⇒ Object
6
7
8
9
10
11
12
13
14
|
# File 'lib/fog/dns/openstack/v2/requests/get_zone.rb', line 6
def get_zone(id, options = {})
, _options = Fog::DNS::OpenStack::V2.(options)
request(
:expects => 200,
:method => 'GET',
:path => "zones/#{id}",
:headers =>
)
end
|
#list_recordsets(zone_id = nil, options = {}) ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/fog/dns/openstack/v2/requests/list_recordsets.rb', line 6
def list_recordsets(zone_id = nil, options = {})
unless zone_id.nil?
if zone_id.kind_of?(Hash)
options = zone_id
zone_id = nil
else
Fog::Logger.deprecation(
'Calling list_recordsets(zone_id) is deprecated, use .list_recordsets(zone_id: value) instead'
)
end
end
zone_id = options.delete(:zone_id) if zone_id.nil?
path = zone_id.nil? ? 'recordsets' : "zones/#{zone_id}/recordsets"
, options = Fog::DNS::OpenStack::V2.(options)
request(
:expects => 200,
:method => 'GET',
:path => path,
:query => options,
:headers =>
)
end
|
#list_zones(options = {}) ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/fog/dns/openstack/v2/requests/list_zones.rb', line 6
def list_zones(options = {})
, options = Fog::DNS::OpenStack::V2.(options)
request(
:expects => 200,
:method => 'GET',
:path => 'zones',
:query => options,
:headers =>
)
end
|
#update_quota(project_id, options = {}) ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/fog/dns/openstack/v2/requests/update_quota.rb', line 6
def update_quota(project_id, options = {})
, options = Fog::DNS::OpenStack::V2.(options)
request(
:body => Fog::JSON.encode(options),
:expects => 200,
:method => 'PATCH',
:path => "quotas/#{project_id}",
:headers =>
)
end
|
#update_recordset(zone_id, id, options = {}) ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/fog/dns/openstack/v2/requests/update_recordset.rb', line 6
def update_recordset(zone_id, id, options = {})
, options = Fog::DNS::OpenStack::V2.(options)
request(
:body => Fog::JSON.encode(options),
:expects => 202,
:method => 'PUT',
:path => "zones/#{zone_id}/recordsets/#{id}",
:headers =>
)
end
|
#update_zone(id, options = {}) ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/fog/dns/openstack/v2/requests/update_zone.rb', line 6
def update_zone(id, options = {})
, options = Fog::DNS::OpenStack::V2.(options)
request(
:body => Fog::JSON.encode(options),
:expects => 202,
:method => 'PATCH',
:path => "zones/#{id}",
:headers =>
)
end
|