Class: Fog::DNS::HuaweiCloud::V2::Real
- Inherits:
-
Object
- Object
- Fog::DNS::HuaweiCloud::V2::Real
- Includes:
- HuaweiCloud::Core
- Defined in:
- lib/fog/dns/huaweicloud/v2.rb,
lib/fog/dns/huaweicloud/v2/requests/get_pool.rb,
lib/fog/dns/huaweicloud/v2/requests/get_zone.rb,
lib/fog/dns/huaweicloud/v2/requests/get_quota.rb,
lib/fog/dns/huaweicloud/v2/requests/list_pools.rb,
lib/fog/dns/huaweicloud/v2/requests/list_zones.rb,
lib/fog/dns/huaweicloud/v2/requests/create_zone.rb,
lib/fog/dns/huaweicloud/v2/requests/delete_zone.rb,
lib/fog/dns/huaweicloud/v2/requests/update_zone.rb,
lib/fog/dns/huaweicloud/v2/requests/update_quota.rb,
lib/fog/dns/huaweicloud/v2/requests/get_recordset.rb,
lib/fog/dns/huaweicloud/v2/requests/list_recordsets.rb,
lib/fog/dns/huaweicloud/v2/requests/create_recordset.rb,
lib/fog/dns/huaweicloud/v2/requests/delete_recordset.rb,
lib/fog/dns/huaweicloud/v2/requests/update_recordset.rb,
lib/fog/dns/huaweicloud/v2/requests/get_zone_transfer_accept.rb,
lib/fog/dns/huaweicloud/v2/requests/get_zone_transfer_request.rb,
lib/fog/dns/huaweicloud/v2/requests/list_zone_transfer_accepts.rb,
lib/fog/dns/huaweicloud/v2/requests/create_zone_transfer_accept.rb,
lib/fog/dns/huaweicloud/v2/requests/list_zone_transfer_requests.rb,
lib/fog/dns/huaweicloud/v2/requests/create_zone_transfer_request.rb,
lib/fog/dns/huaweicloud/v2/requests/delete_zone_transfer_request.rb,
lib/fog/dns/huaweicloud/v2/requests/update_zone_transfer_request.rb
Class Method Summary collapse
Instance Method Summary collapse
- #create_recordset(zone_id, name, type, records, options = {}) ⇒ Object
- #create_zone(name, email, options = {}) ⇒ Object
- #create_zone_transfer_accept(key, zone_transfer_request_id, options = {}) ⇒ Object
- #create_zone_transfer_request(zone_id, options = {}) ⇒ Object
- #delete_recordset(zone_id, id, options = {}) ⇒ Object
- #delete_zone(id, options = {}) ⇒ Object
- #delete_zone_transfer_request(zone_transfer_request_id) ⇒ Object
- #get_pool(id, options = {}) ⇒ Object
- #get_quota(project_id = nil) ⇒ Object
- #get_recordset(zone_id, id, options = {}) ⇒ Object
- #get_zone(id, options = {}) ⇒ Object
- #get_zone_transfer_accept(zone_transfer_accept_id) ⇒ Object
- #get_zone_transfer_request(zone_transfer_request_id) ⇒ Object
-
#initialize(options = {}) ⇒ Real
constructor
A new instance of Real.
- #list_pools(options = {}) ⇒ Object
- #list_recordsets(zone_id = nil, options = {}) ⇒ Object
- #list_zone_transfer_accepts(options = {}) ⇒ Object
- #list_zone_transfer_requests(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
- #update_zone_transfer_request(zone_transfer_request_id, description, options = {}) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Real
Returns a new instance of Real.
314 315 316 317 318 319 320 321 322 323 324 325 326 |
# File 'lib/fog/dns/huaweicloud/v2.rb', line 314 def initialize( = {}) initialize_identity @huaweicloud_service_type = [:huaweicloud_service_type] || ['dns'] @huaweicloud_service_name = [:huaweicloud_service_name] @connection_options = [:connection_options] || {} authenticate set_api_path @persistent = [:persistent] || false @connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}/", @persistent, @connection_options) end |
Class Method Details
.not_found_class ⇒ Object
310 311 312 |
# File 'lib/fog/dns/huaweicloud/v2.rb', line 310 def self.not_found_class Fog::DNS::HuaweiCloud::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/huaweicloud/v2/requests/create_recordset.rb', line 6 def create_recordset(zone_id, name, type, records, = {}) data = { 'name' => name, 'type' => type, 'records' => records } = [:ttl, :description] .select { |o| [o] }.each do |key| data[key] = [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/huaweicloud/v2/requests/create_zone.rb', line 6 def create_zone(name, email, = {}) data = { 'name' => name, 'email' => email } = [:ttl, :description, :type, :masters, :attributes] .select { |o| [o] }.each do |key| data[key] = [key] end request( :body => Fog::JSON.encode(data), :expects => 202, :method => 'POST', :path => "zones" ) end |
#create_zone_transfer_accept(key, zone_transfer_request_id, options = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/fog/dns/huaweicloud/v2/requests/create_zone_transfer_accept.rb', line 6 def create_zone_transfer_accept(key, zone_transfer_request_id, = {}) data = { :key => key, :zone_transfer_request_id => zone_transfer_request_id } headers, = Fog::DNS::HuaweiCloud::V2.setup_headers() request( :headers => headers, :body => Fog::JSON.encode(data), :expects => 200, :method => 'POST', :path => "zones/tasks/transfer_accepts" ) end |
#create_zone_transfer_request(zone_id, options = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/fog/dns/huaweicloud/v2/requests/create_zone_transfer_request.rb', line 7 def create_zone_transfer_request(zone_id, = {}) = [:target_project_id, :description, :project_id] data = .inject({}) do |result,option| result[option] = [option] if [option] result end request( :body => Fog::JSON.encode(data), :expects => 201, :method => 'POST', :path => "zones/#{zone_id}/tasks/transfer_requests" ) end |
#delete_recordset(zone_id, id, options = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/fog/dns/huaweicloud/v2/requests/delete_recordset.rb', line 6 def delete_recordset(zone_id, id, = {}) headers, = Fog::DNS::HuaweiCloud::V2.setup_headers() request( :expects => 202, :method => 'DELETE', :path => "zones/#{zone_id}/recordsets/#{id}", :headers => headers ) end |
#delete_zone(id, options = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/fog/dns/huaweicloud/v2/requests/delete_zone.rb', line 6 def delete_zone(id, = {}) headers, = Fog::DNS::HuaweiCloud::V2.setup_headers() request( :expects => 202, :method => 'DELETE', :path => "zones/#{id}", :headers => headers ) end |
#delete_zone_transfer_request(zone_transfer_request_id) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/fog/dns/huaweicloud/v2/requests/delete_zone_transfer_request.rb', line 7 def delete_zone_transfer_request(zone_transfer_request_id) request( :expects => 204, :method => 'DELETE', :path => "zones/tasks/transfer_requests/#{zone_transfer_request_id}" ) end |
#get_pool(id, options = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/fog/dns/huaweicloud/v2/requests/get_pool.rb', line 6 def get_pool(id, = {}) headers, = Fog::DNS::HuaweiCloud::V2.setup_headers() request( :expects => 200, :method => 'GET', :path => "pools/#{id}", :headers => headers ) end |
#get_quota(project_id = nil) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/fog/dns/huaweicloud/v2/requests/get_quota.rb', line 6 def get_quota(project_id = nil) headers, = Fog::DNS::HuaweiCloud::V2.setup_headers(:all_projects => !project_id.nil?) request( :expects => 200, :method => 'GET', :path => "quotas/#{project_id}", :headers => headers ) end |
#get_recordset(zone_id, id, options = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/fog/dns/huaweicloud/v2/requests/get_recordset.rb', line 6 def get_recordset(zone_id, id, = {}) headers, = Fog::DNS::HuaweiCloud::V2.setup_headers() request( :expects => 200, :method => 'GET', :path => "zones/#{zone_id}/recordsets/#{id}", :headers => headers ) end |
#get_zone(id, options = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/fog/dns/huaweicloud/v2/requests/get_zone.rb', line 6 def get_zone(id, = {}) headers, = Fog::DNS::HuaweiCloud::V2.setup_headers() request( :expects => 200, :method => 'GET', :path => "zones/#{id}", :headers => headers ) end |
#get_zone_transfer_accept(zone_transfer_accept_id) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/fog/dns/huaweicloud/v2/requests/get_zone_transfer_accept.rb', line 6 def get_zone_transfer_accept(zone_transfer_accept_id) request( :expects => 200, :method => 'GET', :path => "zones/tasks/transfer_requests/#{zone_transfer_accept_id}" ) end |
#get_zone_transfer_request(zone_transfer_request_id) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/fog/dns/huaweicloud/v2/requests/get_zone_transfer_request.rb', line 7 def get_zone_transfer_request(zone_transfer_request_id) request( :expects => 200, :method => 'GET', :path => "zones/tasks/transfer_requests/#{zone_transfer_request_id}" ) end |
#list_pools(options = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/fog/dns/huaweicloud/v2/requests/list_pools.rb', line 6 def list_pools( = {}) headers, = Fog::DNS::HuaweiCloud::V2.setup_headers() request( :expects => 200, :method => 'GET', :path => 'pools', :query => , :headers => 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/huaweicloud/v2/requests/list_recordsets.rb', line 6 def list_recordsets(zone_id = nil, = {}) # for backward compatability: consider removing the zone_id param (breaking change) unless zone_id.nil? if zone_id.kind_of?(Hash) = 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 = .delete(:zone_id) if zone_id.nil? path = zone_id.nil? ? 'recordsets' : "zones/#{zone_id}/recordsets" headers, = Fog::DNS::HuaweiCloud::V2.setup_headers() request( :expects => 200, :method => 'GET', :path => path, :query => , :headers => headers ) end |
#list_zone_transfer_accepts(options = {}) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/fog/dns/huaweicloud/v2/requests/list_zone_transfer_accepts.rb', line 6 def list_zone_transfer_accepts(={}) request( :expects => 200, :method => 'GET', :path => "zones/tasks/transfer_accepts", :query => ) end |
#list_zone_transfer_requests(options = {}) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/fog/dns/huaweicloud/v2/requests/list_zone_transfer_requests.rb', line 6 def list_zone_transfer_requests(={}) request( :expects => 200, :method => 'GET', :path => "zones/tasks/transfer_requests", :query => ) end |
#list_zones(options = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/fog/dns/huaweicloud/v2/requests/list_zones.rb', line 6 def list_zones( = {}) headers, = Fog::DNS::HuaweiCloud::V2.setup_headers() request( :expects => 200, :method => 'GET', :path => 'zones', :query => , :headers => headers ) end |
#set_api_path ⇒ Object
328 329 330 331 332 333 334 335 336 337 |
# File 'lib/fog/dns/huaweicloud/v2.rb', line 328 def set_api_path unless @path.match(SUPPORTED_VERSIONS) @path = Fog::HuaweiCloud.get_supported_version_path( SUPPORTED_VERSIONS, @huaweicloud_management_uri, @auth_token, @connection_options ) end end |
#update_quota(project_id, options = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/fog/dns/huaweicloud/v2/requests/update_quota.rb', line 6 def update_quota(project_id, = {}) headers, = Fog::DNS::HuaweiCloud::V2.setup_headers() request( :body => Fog::JSON.encode(), :expects => 200, :method => 'PATCH', :path => "quotas/#{project_id}", :headers => headers ) end |
#update_recordset(zone_id, id, options = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/fog/dns/huaweicloud/v2/requests/update_recordset.rb', line 6 def update_recordset(zone_id, id, = {}) headers, = Fog::DNS::HuaweiCloud::V2.setup_headers() request( :body => Fog::JSON.encode(), :expects => 202, :method => 'PUT', :path => "zones/#{zone_id}/recordsets/#{id}", :headers => headers ) end |
#update_zone(id, options = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/fog/dns/huaweicloud/v2/requests/update_zone.rb', line 6 def update_zone(id, = {}) headers, = Fog::DNS::HuaweiCloud::V2.setup_headers() request( :body => Fog::JSON.encode(), :expects => 202, :method => 'PATCH', :path => "zones/#{id}", :headers => headers ) end |
#update_zone_transfer_request(zone_transfer_request_id, description, options = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/fog/dns/huaweicloud/v2/requests/update_zone_transfer_request.rb', line 6 def update_zone_transfer_request(zone_transfer_request_id,description,={}) = [:target_project_id] data = .inject({}) do |result,option| result[option] = [option] if [option] result end request( :expects => 200, :method => 'PATCH', :path => "zones/tasks/transfer_requests/#{zone_transfer_request_id}", :body => Fog::JSON.encode(data) ) end |